imate
C++/CUDA Reference
_hutchinson_method.cpp
Go to the documentation of this file.
1 /* Generated by Cython 0.29.36 */
2 
3 /* BEGIN: Cython Metadata
4 {
5  "distutils": {
6  "define_macros": [
7  [
8  "CYTHON_EXTERN_C",
9  "extern \"C\""
10  ],
11  [
12  "CYTHON_EXTERN_C",
13  "extern \"C\""
14  ],
15  [
16  "CYTHON_EXTERN_C",
17  "extern \"C\""
18  ],
19  [
20  "CYTHON_EXTERN_C",
21  "extern \"C\""
22  ],
23  [
24  "CYTHON_EXTERN_C",
25  "extern \"C\""
26  ],
27  [
28  "CYTHON_EXTERN_C",
29  "extern \"C\""
30  ],
31  [
32  "CYTHON_EXTERN_C",
33  "extern \"C\""
34  ],
35  [
36  "CYTHON_EXTERN_C",
37  "extern \"C\""
38  ],
39  [
40  "CYTHON_EXTERN_C",
41  "extern \"C\""
42  ],
43  [
44  "CYTHON_EXTERN_C",
45  "extern \"C\""
46  ],
47  [
48  "CYTHON_EXTERN_C",
49  "extern \"C\""
50  ],
51  [
52  "CYTHON_EXTERN_C",
53  "extern \"C\""
54  ],
55  [
56  "CYTHON_EXTERN_C",
57  "extern \"C\""
58  ],
59  [
60  "CYTHON_EXTERN_C",
61  "extern \"C\""
62  ],
63  [
64  "CYTHON_EXTERN_C",
65  "extern \"C\""
66  ]
67  ],
68  "depends": [
69  "imate/_c_basic_algebra/c_vector_operations.cpp",
70  "imate/_c_basic_algebra/c_vector_operations.h",
71  "imate/_definitions/definitions.h"
72  ],
73  "include_dirs": [
74  "./imate/_c_basic_algebra",
75  "./imate/_definitions",
76  "./imate/traceinv",
77  "i",
78  "m",
79  "a",
80  "t",
81  "e",
82  "/",
83  "f",
84  "u",
85  "n",
86  "c",
87  "o",
88  "s",
89  "_",
90  "b",
91  "l",
92  "g",
93  "r"
94  ],
95  "language": "c++",
96  "name": "imate.traceinv._hutchinson_method",
97  "sources": [
98  "./imate/traceinv/_hutchinson_method.pyx",
99  "imate/functions/power.cpp",
100  "imate/functions/exponential.cpp",
101  "imate/functions/gaussian.cpp",
102  "imate/functions/functions.cpp",
103  "imate/functions/inverse.cpp",
104  "imate/functions/logarithm.cpp",
105  "imate/functions/smoothstep.cpp",
106  "imate/functions/indicator.cpp",
107  "imate/functions/homographic.cpp",
108  "imate/functions/identity.cpp",
109  "imate/_c_basic_algebra/c_vector_operations.cpp",
110  "imate/_c_basic_algebra/c_matrix_operations.cpp",
111  "imate/_c_basic_algebra/cblas_interface.cpp"
112  ]
113  },
114  "module_name": "imate.traceinv._hutchinson_method"
115 }
116 END: Cython Metadata */
117 
118 #ifndef PY_SSIZE_T_CLEAN
119 #define PY_SSIZE_T_CLEAN
120 #endif /* PY_SSIZE_T_CLEAN */
121 #include "Python.h"
122 #ifndef Py_PYTHON_H
123  #error Python headers needed to compile C extensions, please install development version of Python.
124 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
125  #error Cython requires Python 2.6+ or Python 3.3+.
126 #else
127 #define CYTHON_ABI "0_29_36"
128 #define CYTHON_HEX_VERSION 0x001D24F0
129 #define CYTHON_FUTURE_DIVISION 1
130 #include <stddef.h>
131 #ifndef offsetof
132  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
133 #endif
134 #if !defined(WIN32) && !defined(MS_WINDOWS)
135  #ifndef __stdcall
136  #define __stdcall
137  #endif
138  #ifndef __cdecl
139  #define __cdecl
140  #endif
141  #ifndef __fastcall
142  #define __fastcall
143  #endif
144 #endif
145 #ifndef DL_IMPORT
146  #define DL_IMPORT(t) t
147 #endif
148 #ifndef DL_EXPORT
149  #define DL_EXPORT(t) t
150 #endif
151 #define __PYX_COMMA ,
152 #ifndef HAVE_LONG_LONG
153  #if PY_VERSION_HEX >= 0x02070000
154  #define HAVE_LONG_LONG
155  #endif
156 #endif
157 #ifndef PY_LONG_LONG
158  #define PY_LONG_LONG LONG_LONG
159 #endif
160 #ifndef Py_HUGE_VAL
161  #define Py_HUGE_VAL HUGE_VAL
162 #endif
163 #ifdef PYPY_VERSION
164  #define CYTHON_COMPILING_IN_PYPY 1
165  #define CYTHON_COMPILING_IN_PYSTON 0
166  #define CYTHON_COMPILING_IN_CPYTHON 0
167  #define CYTHON_COMPILING_IN_NOGIL 0
168  #undef CYTHON_USE_TYPE_SLOTS
169  #define CYTHON_USE_TYPE_SLOTS 0
170  #undef CYTHON_USE_PYTYPE_LOOKUP
171  #define CYTHON_USE_PYTYPE_LOOKUP 0
172  #if PY_VERSION_HEX < 0x03050000
173  #undef CYTHON_USE_ASYNC_SLOTS
174  #define CYTHON_USE_ASYNC_SLOTS 0
175  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
176  #define CYTHON_USE_ASYNC_SLOTS 1
177  #endif
178  #undef CYTHON_USE_PYLIST_INTERNALS
179  #define CYTHON_USE_PYLIST_INTERNALS 0
180  #undef CYTHON_USE_UNICODE_INTERNALS
181  #define CYTHON_USE_UNICODE_INTERNALS 0
182  #undef CYTHON_USE_UNICODE_WRITER
183  #define CYTHON_USE_UNICODE_WRITER 0
184  #undef CYTHON_USE_PYLONG_INTERNALS
185  #define CYTHON_USE_PYLONG_INTERNALS 0
186  #undef CYTHON_AVOID_BORROWED_REFS
187  #define CYTHON_AVOID_BORROWED_REFS 1
188  #undef CYTHON_ASSUME_SAFE_MACROS
189  #define CYTHON_ASSUME_SAFE_MACROS 0
190  #undef CYTHON_UNPACK_METHODS
191  #define CYTHON_UNPACK_METHODS 0
192  #undef CYTHON_FAST_THREAD_STATE
193  #define CYTHON_FAST_THREAD_STATE 0
194  #undef CYTHON_FAST_PYCALL
195  #define CYTHON_FAST_PYCALL 0
196  #if PY_VERSION_HEX < 0x03090000
197  #undef CYTHON_PEP489_MULTI_PHASE_INIT
198  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
199  #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
200  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
201  #endif
202  #undef CYTHON_USE_TP_FINALIZE
203  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
204  #undef CYTHON_USE_DICT_VERSIONS
205  #define CYTHON_USE_DICT_VERSIONS 0
206  #undef CYTHON_USE_EXC_INFO_STACK
207  #define CYTHON_USE_EXC_INFO_STACK 0
208  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
209  #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
210  #endif
211 #elif defined(PYSTON_VERSION)
212  #define CYTHON_COMPILING_IN_PYPY 0
213  #define CYTHON_COMPILING_IN_PYSTON 1
214  #define CYTHON_COMPILING_IN_CPYTHON 0
215  #define CYTHON_COMPILING_IN_NOGIL 0
216  #ifndef CYTHON_USE_TYPE_SLOTS
217  #define CYTHON_USE_TYPE_SLOTS 1
218  #endif
219  #undef CYTHON_USE_PYTYPE_LOOKUP
220  #define CYTHON_USE_PYTYPE_LOOKUP 0
221  #undef CYTHON_USE_ASYNC_SLOTS
222  #define CYTHON_USE_ASYNC_SLOTS 0
223  #undef CYTHON_USE_PYLIST_INTERNALS
224  #define CYTHON_USE_PYLIST_INTERNALS 0
225  #ifndef CYTHON_USE_UNICODE_INTERNALS
226  #define CYTHON_USE_UNICODE_INTERNALS 1
227  #endif
228  #undef CYTHON_USE_UNICODE_WRITER
229  #define CYTHON_USE_UNICODE_WRITER 0
230  #undef CYTHON_USE_PYLONG_INTERNALS
231  #define CYTHON_USE_PYLONG_INTERNALS 0
232  #ifndef CYTHON_AVOID_BORROWED_REFS
233  #define CYTHON_AVOID_BORROWED_REFS 0
234  #endif
235  #ifndef CYTHON_ASSUME_SAFE_MACROS
236  #define CYTHON_ASSUME_SAFE_MACROS 1
237  #endif
238  #ifndef CYTHON_UNPACK_METHODS
239  #define CYTHON_UNPACK_METHODS 1
240  #endif
241  #undef CYTHON_FAST_THREAD_STATE
242  #define CYTHON_FAST_THREAD_STATE 0
243  #undef CYTHON_FAST_PYCALL
244  #define CYTHON_FAST_PYCALL 0
245  #undef CYTHON_PEP489_MULTI_PHASE_INIT
246  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
247  #undef CYTHON_USE_TP_FINALIZE
248  #define CYTHON_USE_TP_FINALIZE 0
249  #undef CYTHON_USE_DICT_VERSIONS
250  #define CYTHON_USE_DICT_VERSIONS 0
251  #undef CYTHON_USE_EXC_INFO_STACK
252  #define CYTHON_USE_EXC_INFO_STACK 0
253  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
254  #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
255  #endif
256 #elif defined(PY_NOGIL)
257  #define CYTHON_COMPILING_IN_PYPY 0
258  #define CYTHON_COMPILING_IN_PYSTON 0
259  #define CYTHON_COMPILING_IN_CPYTHON 0
260  #define CYTHON_COMPILING_IN_NOGIL 1
261  #ifndef CYTHON_USE_TYPE_SLOTS
262  #define CYTHON_USE_TYPE_SLOTS 1
263  #endif
264  #undef CYTHON_USE_PYTYPE_LOOKUP
265  #define CYTHON_USE_PYTYPE_LOOKUP 0
266  #ifndef CYTHON_USE_ASYNC_SLOTS
267  #define CYTHON_USE_ASYNC_SLOTS 1
268  #endif
269  #undef CYTHON_USE_PYLIST_INTERNALS
270  #define CYTHON_USE_PYLIST_INTERNALS 0
271  #ifndef CYTHON_USE_UNICODE_INTERNALS
272  #define CYTHON_USE_UNICODE_INTERNALS 1
273  #endif
274  #undef CYTHON_USE_UNICODE_WRITER
275  #define CYTHON_USE_UNICODE_WRITER 0
276  #undef CYTHON_USE_PYLONG_INTERNALS
277  #define CYTHON_USE_PYLONG_INTERNALS 0
278  #ifndef CYTHON_AVOID_BORROWED_REFS
279  #define CYTHON_AVOID_BORROWED_REFS 0
280  #endif
281  #ifndef CYTHON_ASSUME_SAFE_MACROS
282  #define CYTHON_ASSUME_SAFE_MACROS 1
283  #endif
284  #ifndef CYTHON_UNPACK_METHODS
285  #define CYTHON_UNPACK_METHODS 1
286  #endif
287  #undef CYTHON_FAST_THREAD_STATE
288  #define CYTHON_FAST_THREAD_STATE 0
289  #undef CYTHON_FAST_PYCALL
290  #define CYTHON_FAST_PYCALL 0
291  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
292  #define CYTHON_PEP489_MULTI_PHASE_INIT 1
293  #endif
294  #ifndef CYTHON_USE_TP_FINALIZE
295  #define CYTHON_USE_TP_FINALIZE 1
296  #endif
297  #undef CYTHON_USE_DICT_VERSIONS
298  #define CYTHON_USE_DICT_VERSIONS 0
299  #undef CYTHON_USE_EXC_INFO_STACK
300  #define CYTHON_USE_EXC_INFO_STACK 0
301 #else
302  #define CYTHON_COMPILING_IN_PYPY 0
303  #define CYTHON_COMPILING_IN_PYSTON 0
304  #define CYTHON_COMPILING_IN_CPYTHON 1
305  #define CYTHON_COMPILING_IN_NOGIL 0
306  #ifndef CYTHON_USE_TYPE_SLOTS
307  #define CYTHON_USE_TYPE_SLOTS 1
308  #endif
309  #if PY_VERSION_HEX < 0x02070000
310  #undef CYTHON_USE_PYTYPE_LOOKUP
311  #define CYTHON_USE_PYTYPE_LOOKUP 0
312  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
313  #define CYTHON_USE_PYTYPE_LOOKUP 1
314  #endif
315  #if PY_MAJOR_VERSION < 3
316  #undef CYTHON_USE_ASYNC_SLOTS
317  #define CYTHON_USE_ASYNC_SLOTS 0
318  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
319  #define CYTHON_USE_ASYNC_SLOTS 1
320  #endif
321  #if PY_VERSION_HEX < 0x02070000
322  #undef CYTHON_USE_PYLONG_INTERNALS
323  #define CYTHON_USE_PYLONG_INTERNALS 0
324  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
325  #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
326  #endif
327  #ifndef CYTHON_USE_PYLIST_INTERNALS
328  #define CYTHON_USE_PYLIST_INTERNALS 1
329  #endif
330  #ifndef CYTHON_USE_UNICODE_INTERNALS
331  #define CYTHON_USE_UNICODE_INTERNALS 1
332  #endif
333  #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
334  #undef CYTHON_USE_UNICODE_WRITER
335  #define CYTHON_USE_UNICODE_WRITER 0
336  #elif !defined(CYTHON_USE_UNICODE_WRITER)
337  #define CYTHON_USE_UNICODE_WRITER 1
338  #endif
339  #ifndef CYTHON_AVOID_BORROWED_REFS
340  #define CYTHON_AVOID_BORROWED_REFS 0
341  #endif
342  #ifndef CYTHON_ASSUME_SAFE_MACROS
343  #define CYTHON_ASSUME_SAFE_MACROS 1
344  #endif
345  #ifndef CYTHON_UNPACK_METHODS
346  #define CYTHON_UNPACK_METHODS 1
347  #endif
348  #if PY_VERSION_HEX >= 0x030B00A4
349  #undef CYTHON_FAST_THREAD_STATE
350  #define CYTHON_FAST_THREAD_STATE 0
351  #elif !defined(CYTHON_FAST_THREAD_STATE)
352  #define CYTHON_FAST_THREAD_STATE 1
353  #endif
354  #ifndef CYTHON_FAST_PYCALL
355  #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
356  #endif
357  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
358  #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
359  #endif
360  #ifndef CYTHON_USE_TP_FINALIZE
361  #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
362  #endif
363  #ifndef CYTHON_USE_DICT_VERSIONS
364  #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
365  #endif
366  #if PY_VERSION_HEX >= 0x030B00A4
367  #undef CYTHON_USE_EXC_INFO_STACK
368  #define CYTHON_USE_EXC_INFO_STACK 0
369  #elif !defined(CYTHON_USE_EXC_INFO_STACK)
370  #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
371  #endif
372  #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
373  #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
374  #endif
375 #endif
376 #if !defined(CYTHON_FAST_PYCCALL)
377 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
378 #endif
379 #if CYTHON_USE_PYLONG_INTERNALS
380  #if PY_MAJOR_VERSION < 3
381  #include "longintrepr.h"
382  #endif
383  #undef SHIFT
384  #undef BASE
385  #undef MASK
386  #ifdef SIZEOF_VOID_P
387  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
388  #endif
389 #endif
390 #ifndef __has_attribute
391  #define __has_attribute(x) 0
392 #endif
393 #ifndef __has_cpp_attribute
394  #define __has_cpp_attribute(x) 0
395 #endif
396 #ifndef CYTHON_RESTRICT
397  #if defined(__GNUC__)
398  #define CYTHON_RESTRICT __restrict__
399  #elif defined(_MSC_VER) && _MSC_VER >= 1400
400  #define CYTHON_RESTRICT __restrict
401  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
402  #define CYTHON_RESTRICT restrict
403  #else
404  #define CYTHON_RESTRICT
405  #endif
406 #endif
407 #ifndef CYTHON_UNUSED
408 # if defined(__GNUC__)
409 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
410 # define CYTHON_UNUSED __attribute__ ((__unused__))
411 # else
412 # define CYTHON_UNUSED
413 # endif
414 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
415 # define CYTHON_UNUSED __attribute__ ((__unused__))
416 # else
417 # define CYTHON_UNUSED
418 # endif
419 #endif
420 #ifndef CYTHON_MAYBE_UNUSED_VAR
421 # if defined(__cplusplus)
422  template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
423 # else
424 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
425 # endif
426 #endif
427 #ifndef CYTHON_NCP_UNUSED
428 # if CYTHON_COMPILING_IN_CPYTHON
429 # define CYTHON_NCP_UNUSED
430 # else
431 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
432 # endif
433 #endif
434 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
435 #ifdef _MSC_VER
436  #ifndef _MSC_STDINT_H_
437  #if _MSC_VER < 1300
438  typedef unsigned char uint8_t;
439  typedef unsigned int uint32_t;
440  #else
441  typedef unsigned __int8 uint8_t;
442  typedef unsigned __int32 uint32_t;
443  #endif
444  #endif
445 #else
446  #include <stdint.h>
447 #endif
448 #ifndef CYTHON_FALLTHROUGH
449  #if defined(__cplusplus) && __cplusplus >= 201103L
450  #if __has_cpp_attribute(fallthrough)
451  #define CYTHON_FALLTHROUGH [[fallthrough]]
452  #elif __has_cpp_attribute(clang::fallthrough)
453  #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
454  #elif __has_cpp_attribute(gnu::fallthrough)
455  #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
456  #endif
457  #endif
458  #ifndef CYTHON_FALLTHROUGH
459  #if __has_attribute(fallthrough)
460  #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
461  #else
462  #define CYTHON_FALLTHROUGH
463  #endif
464  #endif
465  #if defined(__clang__ ) && defined(__apple_build_version__)
466  #if __apple_build_version__ < 7000000
467  #undef CYTHON_FALLTHROUGH
468  #define CYTHON_FALLTHROUGH
469  #endif
470  #endif
471 #endif
472 
473 #ifndef __cplusplus
474  #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
475 #endif
476 #ifndef CYTHON_INLINE
477  #if defined(__clang__)
478  #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
479  #else
480  #define CYTHON_INLINE inline
481  #endif
482 #endif
483 template<typename T>
484 void __Pyx_call_destructor(T& x) {
485  x.~T();
486 }
487 template<typename T>
488 class __Pyx_FakeReference {
489  public:
490  __Pyx_FakeReference() : ptr(NULL) { }
491  __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
492  T *operator->() { return ptr; }
493  T *operator&() { return ptr; }
494  operator T&() { return *ptr; }
495  template<typename U> bool operator ==(U other) { return *ptr == other; }
496  template<typename U> bool operator !=(U other) { return *ptr != other; }
497  private:
498  T *ptr;
499 };
500 
501 #define __PYX_BUILD_PY_SSIZE_T "n"
502 #define CYTHON_FORMAT_SSIZE_T "z"
503 #if PY_MAJOR_VERSION < 3
504  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
505  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
506  PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
507  #define __Pyx_DefaultClassType PyClass_Type
508 #else
509  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
510  #define __Pyx_DefaultClassType PyType_Type
511 #if PY_VERSION_HEX >= 0x030B00A1
512  static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f,
513  PyObject *code, PyObject *c, PyObject* n, PyObject *v,
514  PyObject *fv, PyObject *cell, PyObject* fn,
515  PyObject *name, int fline, PyObject *lnos) {
516  PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
517  PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
518  const char *fn_cstr=NULL;
519  const char *name_cstr=NULL;
520  PyCodeObject* co=NULL;
521  PyObject *type, *value, *traceback;
522  PyErr_Fetch(&type, &value, &traceback);
523  if (!(kwds=PyDict_New())) goto end;
524  if (!(argcount=PyLong_FromLong(a))) goto end;
525  if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end;
526  if (!(posonlyargcount=PyLong_FromLong(0))) goto end;
527  if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end;
528  if (!(kwonlyargcount=PyLong_FromLong(k))) goto end;
529  if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end;
530  if (!(nlocals=PyLong_FromLong(l))) goto end;
531  if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end;
532  if (!(stacksize=PyLong_FromLong(s))) goto end;
533  if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end;
534  if (!(flags=PyLong_FromLong(f))) goto end;
535  if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end;
536  if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end;
537  if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end;
538  if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end;
539  if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end;
540  if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end;
541  if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end;
542  if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end;
543  if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end;
544  if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end;
545  if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end;
546  if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too;
547  if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here
548  if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too;
549  Py_XDECREF((PyObject*)co);
550  co = (PyCodeObject*)call_result;
551  call_result = NULL;
552  if (0) {
553  cleanup_code_too:
554  Py_XDECREF((PyObject*)co);
555  co = NULL;
556  }
557  end:
558  Py_XDECREF(kwds);
559  Py_XDECREF(argcount);
560  Py_XDECREF(posonlyargcount);
561  Py_XDECREF(kwonlyargcount);
562  Py_XDECREF(nlocals);
563  Py_XDECREF(stacksize);
564  Py_XDECREF(replace);
565  Py_XDECREF(call_result);
566  Py_XDECREF(empty);
567  if (type) {
568  PyErr_Restore(type, value, traceback);
569  }
570  return co;
571  }
572 #else
573  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
574  PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
575 #endif
576  #define __Pyx_DefaultClassType PyType_Type
577 #endif
578 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
579  #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
580 #else
581  #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
582 #endif
583 #ifndef Py_TPFLAGS_CHECKTYPES
584  #define Py_TPFLAGS_CHECKTYPES 0
585 #endif
586 #ifndef Py_TPFLAGS_HAVE_INDEX
587  #define Py_TPFLAGS_HAVE_INDEX 0
588 #endif
589 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
590  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
591 #endif
592 #ifndef Py_TPFLAGS_HAVE_FINALIZE
593  #define Py_TPFLAGS_HAVE_FINALIZE 0
594 #endif
595 #ifndef METH_STACKLESS
596  #define METH_STACKLESS 0
597 #endif
598 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
599  #ifndef METH_FASTCALL
600  #define METH_FASTCALL 0x80
601  #endif
602  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
603  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
604  Py_ssize_t nargs, PyObject *kwnames);
605 #else
606  #define __Pyx_PyCFunctionFast _PyCFunctionFast
607  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
608 #endif
609 #if CYTHON_FAST_PYCCALL
610 #define __Pyx_PyFastCFunction_Check(func)\
611  ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
612 #else
613 #define __Pyx_PyFastCFunction_Check(func) 0
614 #endif
615 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
616  #define PyObject_Malloc(s) PyMem_Malloc(s)
617  #define PyObject_Free(p) PyMem_Free(p)
618  #define PyObject_Realloc(p) PyMem_Realloc(p)
619 #endif
620 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
621  #define PyMem_RawMalloc(n) PyMem_Malloc(n)
622  #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
623  #define PyMem_RawFree(p) PyMem_Free(p)
624 #endif
625 #if CYTHON_COMPILING_IN_PYSTON
626  #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
627  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
628 #else
629  #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
630  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
631 #endif
632 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
633  #define __Pyx_PyThreadState_Current PyThreadState_GET()
634 #elif PY_VERSION_HEX >= 0x03060000
635  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
636 #elif PY_VERSION_HEX >= 0x03000000
637  #define __Pyx_PyThreadState_Current PyThreadState_GET()
638 #else
639  #define __Pyx_PyThreadState_Current _PyThreadState_Current
640 #endif
641 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
642 #include "pythread.h"
643 #define Py_tss_NEEDS_INIT 0
644 typedef int Py_tss_t;
645 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
646  *key = PyThread_create_key();
647  return 0;
648 }
649 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
650  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
651  *key = Py_tss_NEEDS_INIT;
652  return key;
653 }
654 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
655  PyObject_Free(key);
656 }
657 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
658  return *key != Py_tss_NEEDS_INIT;
659 }
660 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
661  PyThread_delete_key(*key);
662  *key = Py_tss_NEEDS_INIT;
663 }
664 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
665  return PyThread_set_key_value(*key, value);
666 }
667 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
668  return PyThread_get_key_value(*key);
669 }
670 #endif
671 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
672 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
673 #else
674 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
675 #endif
676 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
677  #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
678  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
679 #else
680  #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
681  #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
682 #endif
683 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
684 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
685 #else
686 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
687 #endif
688 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
689  #define CYTHON_PEP393_ENABLED 1
690  #if PY_VERSION_HEX >= 0x030C0000
691  #define __Pyx_PyUnicode_READY(op) (0)
692  #else
693  #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
694  0 : _PyUnicode_Ready((PyObject *)(op)))
695  #endif
696  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
697  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
698  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
699  #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
700  #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
701  #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
702  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
703  #if PY_VERSION_HEX >= 0x030C0000
704  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
705  #else
706  #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
707  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
708  #else
709  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
710  #endif
711  #endif
712 #else
713  #define CYTHON_PEP393_ENABLED 0
714  #define PyUnicode_1BYTE_KIND 1
715  #define PyUnicode_2BYTE_KIND 2
716  #define PyUnicode_4BYTE_KIND 4
717  #define __Pyx_PyUnicode_READY(op) (0)
718  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
719  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
720  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
721  #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
722  #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
723  #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
724  #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
725  #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
726 #endif
727 #if CYTHON_COMPILING_IN_PYPY
728  #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
729  #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
730 #else
731  #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
732  #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
733  PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
734 #endif
735 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
736  #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
737 #endif
738 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
739  #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
740 #endif
741 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
742  #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
743 #endif
744 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
745 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
746 #if PY_MAJOR_VERSION >= 3
747  #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
748 #else
749  #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
750 #endif
751 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
752  #define PyObject_ASCII(o) PyObject_Repr(o)
753 #endif
754 #if PY_MAJOR_VERSION >= 3
755  #define PyBaseString_Type PyUnicode_Type
756  #define PyStringObject PyUnicodeObject
757  #define PyString_Type PyUnicode_Type
758  #define PyString_Check PyUnicode_Check
759  #define PyString_CheckExact PyUnicode_CheckExact
760 #ifndef PyObject_Unicode
761  #define PyObject_Unicode PyObject_Str
762 #endif
763 #endif
764 #if PY_MAJOR_VERSION >= 3
765  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
766  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
767 #else
768  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
769  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
770 #endif
771 #ifndef PySet_CheckExact
772  #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
773 #endif
774 #if PY_VERSION_HEX >= 0x030900A4
775  #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
776  #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
777 #else
778  #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
779  #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
780 #endif
781 #if CYTHON_ASSUME_SAFE_MACROS
782  #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
783 #else
784  #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
785 #endif
786 #if PY_MAJOR_VERSION >= 3
787  #define PyIntObject PyLongObject
788  #define PyInt_Type PyLong_Type
789  #define PyInt_Check(op) PyLong_Check(op)
790  #define PyInt_CheckExact(op) PyLong_CheckExact(op)
791  #define PyInt_FromString PyLong_FromString
792  #define PyInt_FromUnicode PyLong_FromUnicode
793  #define PyInt_FromLong PyLong_FromLong
794  #define PyInt_FromSize_t PyLong_FromSize_t
795  #define PyInt_FromSsize_t PyLong_FromSsize_t
796  #define PyInt_AsLong PyLong_AsLong
797  #define PyInt_AS_LONG PyLong_AS_LONG
798  #define PyInt_AsSsize_t PyLong_AsSsize_t
799  #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
800  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
801  #define PyNumber_Int PyNumber_Long
802 #endif
803 #if PY_MAJOR_VERSION >= 3
804  #define PyBoolObject PyLongObject
805 #endif
806 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
807  #ifndef PyUnicode_InternFromString
808  #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
809  #endif
810 #endif
811 #if PY_VERSION_HEX < 0x030200A4
812  typedef long Py_hash_t;
813  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
814  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
815 #else
816  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
817  #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
818 #endif
819 #if PY_MAJOR_VERSION >= 3
820  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
821 #else
822  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
823 #endif
824 #if CYTHON_USE_ASYNC_SLOTS
825  #if PY_VERSION_HEX >= 0x030500B1
826  #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
827  #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
828  #else
829  #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
830  #endif
831 #else
832  #define __Pyx_PyType_AsAsync(obj) NULL
833 #endif
834 #ifndef __Pyx_PyAsyncMethodsStruct
835  typedef struct {
836  unaryfunc am_await;
837  unaryfunc am_aiter;
838  unaryfunc am_anext;
839  } __Pyx_PyAsyncMethodsStruct;
840 #endif
841 
842 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
843  #if !defined(_USE_MATH_DEFINES)
844  #define _USE_MATH_DEFINES
845  #endif
846 #endif
847 #include <math.h>
848 #ifdef NAN
849 #define __PYX_NAN() ((float) NAN)
850 #else
851 static CYTHON_INLINE float __PYX_NAN() {
852  float value;
853  memset(&value, 0xFF, sizeof(value));
854  return value;
855 }
856 #endif
857 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
858 #define __Pyx_truncl trunc
859 #else
860 #define __Pyx_truncl truncl
861 #endif
862 
863 #define __PYX_MARK_ERR_POS(f_index, lineno) \
864  { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
865 #define __PYX_ERR(f_index, lineno, Ln_error) \
866  { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
867 
868 #ifndef __PYX_EXTERN_C
869  #ifdef __cplusplus
870  #define __PYX_EXTERN_C extern "C"
871  #else
872  #define __PYX_EXTERN_C extern
873  #endif
874 #endif
875 
876 #define __PYX_HAVE__imate__traceinv___hutchinson_method
877 #define __PYX_HAVE_API__imate__traceinv___hutchinson_method
878 /* Early includes */
879 #include "./definitions.h"
880 #include "c_vector_operations.cpp"
881 #include "c_vector_operations.h"
882 #include "pythread.h"
883 #include <string.h>
884 #include <stdlib.h>
885 #include <stdio.h>
886 #include "pystate.h"
887 #ifdef _OPENMP
888 #include <omp.h>
889 #endif /* _OPENMP */
890 
891 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
892 #define CYTHON_WITHOUT_ASSERTIONS
893 #endif
894 
895 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
896  const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
897 
898 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
899 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
900 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
901 #define __PYX_DEFAULT_STRING_ENCODING ""
902 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
903 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
904 #define __Pyx_uchar_cast(c) ((unsigned char)c)
905 #define __Pyx_long_cast(x) ((long)x)
906 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
907  (sizeof(type) < sizeof(Py_ssize_t)) ||\
908  (sizeof(type) > sizeof(Py_ssize_t) &&\
909  likely(v < (type)PY_SSIZE_T_MAX ||\
910  v == (type)PY_SSIZE_T_MAX) &&\
911  (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
912  v == (type)PY_SSIZE_T_MIN))) ||\
913  (sizeof(type) == sizeof(Py_ssize_t) &&\
914  (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
915  v == (type)PY_SSIZE_T_MAX))) )
916 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
917  return (size_t) i < (size_t) limit;
918 }
919 #if defined (__cplusplus) && __cplusplus >= 201103L
920  #include <cstdlib>
921  #define __Pyx_sst_abs(value) std::abs(value)
922 #elif SIZEOF_INT >= SIZEOF_SIZE_T
923  #define __Pyx_sst_abs(value) abs(value)
924 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
925  #define __Pyx_sst_abs(value) labs(value)
926 #elif defined (_MSC_VER)
927  #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
928 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
929  #define __Pyx_sst_abs(value) llabs(value)
930 #elif defined (__GNUC__)
931  #define __Pyx_sst_abs(value) __builtin_llabs(value)
932 #else
933  #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
934 #endif
935 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
936 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
937 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
938 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
939 #define __Pyx_PyBytes_FromString PyBytes_FromString
940 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
941 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
942 #if PY_MAJOR_VERSION < 3
943  #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
944  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
945 #else
946  #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
947  #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
948 #endif
949 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
950 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
951 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
952 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
953 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
954 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
955 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
956 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
957 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
958 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
959 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
960 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
961 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
962 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
963 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
964 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
965 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
966  const Py_UNICODE *u_end = u;
967  while (*u_end++) ;
968  return (size_t)(u_end - u - 1);
969 }
970 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
971 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
972 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
973 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
974 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
975 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
976 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
977 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
978 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
979 #define __Pyx_PySequence_Tuple(obj)\
980  (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
981 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
982 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
983 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
984 #if CYTHON_ASSUME_SAFE_MACROS
985 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
986 #else
987 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
988 #endif
989 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
990 #if PY_MAJOR_VERSION >= 3
991 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
992 #else
993 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
994 #endif
995 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
996 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
997 static int __Pyx_sys_getdefaultencoding_not_ascii;
998 static int __Pyx_init_sys_getdefaultencoding_params(void) {
999  PyObject* sys;
1000  PyObject* default_encoding = NULL;
1001  PyObject* ascii_chars_u = NULL;
1002  PyObject* ascii_chars_b = NULL;
1003  const char* default_encoding_c;
1004  sys = PyImport_ImportModule("sys");
1005  if (!sys) goto bad;
1006  default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
1007  Py_DECREF(sys);
1008  if (!default_encoding) goto bad;
1009  default_encoding_c = PyBytes_AsString(default_encoding);
1010  if (!default_encoding_c) goto bad;
1011  if (strcmp(default_encoding_c, "ascii") == 0) {
1012  __Pyx_sys_getdefaultencoding_not_ascii = 0;
1013  } else {
1014  char ascii_chars[128];
1015  int c;
1016  for (c = 0; c < 128; c++) {
1017  ascii_chars[c] = c;
1018  }
1019  __Pyx_sys_getdefaultencoding_not_ascii = 1;
1020  ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1021  if (!ascii_chars_u) goto bad;
1022  ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1023  if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1024  PyErr_Format(
1025  PyExc_ValueError,
1026  "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1027  default_encoding_c);
1028  goto bad;
1029  }
1030  Py_DECREF(ascii_chars_u);
1031  Py_DECREF(ascii_chars_b);
1032  }
1033  Py_DECREF(default_encoding);
1034  return 0;
1035 bad:
1036  Py_XDECREF(default_encoding);
1037  Py_XDECREF(ascii_chars_u);
1038  Py_XDECREF(ascii_chars_b);
1039  return -1;
1040 }
1041 #endif
1042 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1043 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1044 #else
1045 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1046 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1047 static char* __PYX_DEFAULT_STRING_ENCODING;
1048 static int __Pyx_init_sys_getdefaultencoding_params(void) {
1049  PyObject* sys;
1050  PyObject* default_encoding = NULL;
1051  char* default_encoding_c;
1052  sys = PyImport_ImportModule("sys");
1053  if (!sys) goto bad;
1054  default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
1055  Py_DECREF(sys);
1056  if (!default_encoding) goto bad;
1057  default_encoding_c = PyBytes_AsString(default_encoding);
1058  if (!default_encoding_c) goto bad;
1059  __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
1060  if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
1061  strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1062  Py_DECREF(default_encoding);
1063  return 0;
1064 bad:
1065  Py_XDECREF(default_encoding);
1066  return -1;
1067 }
1068 #endif
1069 #endif
1070 
1071 
1072 /* Test for GCC > 2.95 */
1073 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1074  #define likely(x) __builtin_expect(!!(x), 1)
1075  #define unlikely(x) __builtin_expect(!!(x), 0)
1076 #else /* !__GNUC__ or GCC < 2.95 */
1077  #define likely(x) (x)
1078  #define unlikely(x) (x)
1079 #endif /* __GNUC__ */
1080 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
1081 
1082 static PyObject *__pyx_m = NULL;
1083 static PyObject *__pyx_d;
1084 static PyObject *__pyx_b;
1085 static PyObject *__pyx_cython_runtime = NULL;
1086 static PyObject *__pyx_empty_tuple;
1087 static PyObject *__pyx_empty_bytes;
1088 static PyObject *__pyx_empty_unicode;
1089 static int __pyx_lineno;
1090 static int __pyx_clineno = 0;
1091 static const char * __pyx_cfilenm= __FILE__;
1092 static const char *__pyx_filename;
1093 
1094 
1095 static const char *__pyx_f[] = {
1096  "imate/traceinv/_hutchinson_method.pyx",
1097  "stringsource",
1098 };
1099 /* MemviewSliceStruct.proto */
1100 struct __pyx_memoryview_obj;
1101 typedef struct {
1102  struct __pyx_memoryview_obj *memview;
1103  char *data;
1104  Py_ssize_t shape[8];
1105  Py_ssize_t strides[8];
1106  Py_ssize_t suboffsets[8];
1107 } __Pyx_memviewslice;
1108 #define __Pyx_MemoryView_Len(m) (m.shape[0])
1109 
1110 /* Atomics.proto */
1111 #include <pythread.h>
1112 #ifndef CYTHON_ATOMICS
1113  #define CYTHON_ATOMICS 1
1114 #endif
1115 #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
1116 #define __pyx_atomic_int_type int
1117 #if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
1118  (__GNUC_MINOR__ > 1 ||\
1119  (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
1120  #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
1121  #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
1122  #ifdef __PYX_DEBUG_ATOMICS
1123  #warning "Using GNU atomics"
1124  #endif
1125 #elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL
1126  #include <intrin.h>
1127  #undef __pyx_atomic_int_type
1128  #define __pyx_atomic_int_type long
1129  #pragma intrinsic (_InterlockedExchangeAdd)
1130  #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
1131  #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
1132  #ifdef __PYX_DEBUG_ATOMICS
1133  #pragma message ("Using MSVC atomics")
1134  #endif
1135 #else
1136  #undef CYTHON_ATOMICS
1137  #define CYTHON_ATOMICS 0
1138  #ifdef __PYX_DEBUG_ATOMICS
1139  #warning "Not using atomics"
1140  #endif
1141 #endif
1142 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1143 #if CYTHON_ATOMICS
1144  #define __pyx_add_acquisition_count(memview)\
1145  __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
1146  #define __pyx_sub_acquisition_count(memview)\
1147  __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
1148 #else
1149  #define __pyx_add_acquisition_count(memview)\
1150  __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1151  #define __pyx_sub_acquisition_count(memview)\
1152  __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1153 #endif
1154 
1155 /* ForceInitThreads.proto */
1156 #ifndef __PYX_FORCE_INIT_THREADS
1157  #define __PYX_FORCE_INIT_THREADS 0
1158 #endif
1159 
1160 /* NoFastGil.proto */
1161 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1162 #define __Pyx_PyGILState_Release PyGILState_Release
1163 #define __Pyx_FastGIL_Remember()
1164 #define __Pyx_FastGIL_Forget()
1165 #define __Pyx_FastGilFuncInit()
1166 
1167 /* BufferFormatStructs.proto */
1168 #define IS_UNSIGNED(type) (((type) -1) > 0)
1169 struct __Pyx_StructField_;
1170 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1171 typedef struct {
1172  const char* name;
1173  struct __Pyx_StructField_* fields;
1174  size_t size;
1175  size_t arraysize[8];
1176  int ndim;
1177  char typegroup;
1178  char is_unsigned;
1179  int flags;
1180 } __Pyx_TypeInfo;
1181 typedef struct __Pyx_StructField_ {
1182  __Pyx_TypeInfo* type;
1183  const char* name;
1184  size_t offset;
1185 } __Pyx_StructField;
1186 typedef struct {
1187  __Pyx_StructField* field;
1188  size_t parent_offset;
1189 } __Pyx_BufFmt_StackElem;
1190 typedef struct {
1191  __Pyx_StructField root;
1192  __Pyx_BufFmt_StackElem* head;
1193  size_t fmt_offset;
1194  size_t new_count, enc_count;
1195  size_t struct_alignment;
1196  int is_complex;
1197  char enc_type;
1198  char new_packmode;
1199  char enc_packmode;
1200  char is_valid_array;
1201 } __Pyx_BufFmt_Context;
1202 
1203 
1204 /* "_definitions/types.pxd":110
1205  *
1206  * # Used for indices of small matrices, or small size iterators
1207  * ctypedef int IndexType # <<<<<<<<<<<<<<
1208  * ctypedef int[:] MemoryViewIndexType
1209  *
1210  */
1211 typedef int __pyx_t_5imate_12_definitions_5types_IndexType;
1212 
1213 /* "_definitions/types.pxd":114
1214  *
1215  * # Used for both flags and integers used as signals, including negative integers
1216  * ctypedef int FlagType # <<<<<<<<<<<<<<
1217  * ctypedef int[:] MemoryViewFlagType
1218  *
1219  */
1220 typedef int __pyx_t_5imate_12_definitions_5types_FlagType;
1221 
1222 /*--- Type declarations ---*/
1223 struct __pyx_array_obj;
1224 struct __pyx_MemviewEnum_obj;
1225 struct __pyx_memoryview_obj;
1226 struct __pyx_memoryviewslice_obj;
1227 
1228 /* "_definitions/types.pxd":107
1229  * ctypedef unsigned int[:] MemoryViewLongIndexType
1230  * ELSE:
1231  * ctypedef int[:] MemoryViewLongIndexType # <<<<<<<<<<<<<<
1232  *
1233  * # Used for indices of small matrices, or small size iterators
1234  */
1235 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewLongIndexType;
1236 
1237 /* "_definitions/types.pxd":111
1238  * # Used for indices of small matrices, or small size iterators
1239  * ctypedef int IndexType
1240  * ctypedef int[:] MemoryViewIndexType # <<<<<<<<<<<<<<
1241  *
1242  * # Used for both flags and integers used as signals, including negative integers
1243  */
1244 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType;
1245 
1246 /* "_definitions/types.pxd":115
1247  * # Used for both flags and integers used as signals, including negative integers
1248  * ctypedef int FlagType
1249  * ctypedef int[:] MemoryViewFlagType # <<<<<<<<<<<<<<
1250  *
1251  *
1252  */
1253 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType;
1254 
1255 /* "_definitions/types.pxd":122
1256  * # ==============
1257  *
1258  * ctypedef double (*kernel_type)( # noqa: E211 # <<<<<<<<<<<<<<
1259  * const double x,
1260  * const double kernel_param) nogil
1261  */
1262 typedef double (*__pyx_t_5imate_12_definitions_5types_kernel_type)(double const , double const );
1263 
1264 /* "View.MemoryView":106
1265  *
1266  * @cname("__pyx_array")
1267  * cdef class array: # <<<<<<<<<<<<<<
1268  *
1269  * cdef:
1270  */
1271 struct __pyx_array_obj {
1272  PyObject_HEAD
1273  struct __pyx_vtabstruct_array *__pyx_vtab;
1274  char *data;
1275  Py_ssize_t len;
1276  char *format;
1277  int ndim;
1278  Py_ssize_t *_shape;
1279  Py_ssize_t *_strides;
1280  Py_ssize_t itemsize;
1281  PyObject *mode;
1282  PyObject *_format;
1283  void (*callback_free_data)(void *);
1284  int free_data;
1285  int dtype_is_object;
1286 };
1287 
1288 
1289 /* "View.MemoryView":280
1290  *
1291  * @cname('__pyx_MemviewEnum')
1292  * cdef class Enum(object): # <<<<<<<<<<<<<<
1293  * cdef object name
1294  * def __init__(self, name):
1295  */
1296 struct __pyx_MemviewEnum_obj {
1297  PyObject_HEAD
1298  PyObject *name;
1299 };
1300 
1301 
1302 /* "View.MemoryView":331
1303  *
1304  * @cname('__pyx_memoryview')
1305  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1306  *
1307  * cdef object obj
1308  */
1309 struct __pyx_memoryview_obj {
1310  PyObject_HEAD
1311  struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1312  PyObject *obj;
1313  PyObject *_size;
1314  PyObject *_array_interface;
1315  PyThread_type_lock lock;
1316  __pyx_atomic_int acquisition_count[2];
1317  __pyx_atomic_int *acquisition_count_aligned_p;
1318  Py_buffer view;
1319  int flags;
1320  int dtype_is_object;
1321  __Pyx_TypeInfo *typeinfo;
1322 };
1323 
1324 
1325 /* "View.MemoryView":967
1326  *
1327  * @cname('__pyx_memoryviewslice')
1328  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1329  * "Internal class for passing memoryview slices to Python"
1330  *
1331  */
1332 struct __pyx_memoryviewslice_obj {
1333  struct __pyx_memoryview_obj __pyx_base;
1334  __Pyx_memviewslice from_slice;
1335  PyObject *from_object;
1336  PyObject *(*to_object_func)(char *);
1337  int (*to_dtype_func)(char *, PyObject *);
1338 };
1339 
1340 
1341 
1342 /* "View.MemoryView":106
1343  *
1344  * @cname("__pyx_array")
1345  * cdef class array: # <<<<<<<<<<<<<<
1346  *
1347  * cdef:
1348  */
1349 
1350 struct __pyx_vtabstruct_array {
1351  PyObject *(*get_memview)(struct __pyx_array_obj *);
1352 };
1353 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1354 
1355 
1356 /* "View.MemoryView":331
1357  *
1358  * @cname('__pyx_memoryview')
1359  * cdef class memoryview(object): # <<<<<<<<<<<<<<
1360  *
1361  * cdef object obj
1362  */
1363 
1364 struct __pyx_vtabstruct_memoryview {
1365  char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
1366  PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
1367  PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1368  PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
1369  PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1370  PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
1371  PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
1372 };
1373 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1374 
1375 
1376 /* "View.MemoryView":967
1377  *
1378  * @cname('__pyx_memoryviewslice')
1379  * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
1380  * "Internal class for passing memoryview slices to Python"
1381  *
1382  */
1383 
1384 struct __pyx_vtabstruct__memoryviewslice {
1385  struct __pyx_vtabstruct_memoryview __pyx_base;
1386 };
1387 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1388 
1389 /* --- Runtime support code (head) --- */
1390 /* Refnanny.proto */
1391 #ifndef CYTHON_REFNANNY
1392  #define CYTHON_REFNANNY 0
1393 #endif
1394 #if CYTHON_REFNANNY
1395  typedef struct {
1396  void (*INCREF)(void*, PyObject*, int);
1397  void (*DECREF)(void*, PyObject*, int);
1398  void (*GOTREF)(void*, PyObject*, int);
1399  void (*GIVEREF)(void*, PyObject*, int);
1400  void* (*SetupContext)(const char*, int, const char*);
1401  void (*FinishContext)(void**);
1402  } __Pyx_RefNannyAPIStruct;
1403  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1404  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1405  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1406 #ifdef WITH_THREAD
1407  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1408  if (acquire_gil) {\
1409  PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1410  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1411  PyGILState_Release(__pyx_gilstate_save);\
1412  } else {\
1413  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1414  }
1415 #else
1416  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1417  __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1418 #endif
1419  #define __Pyx_RefNannyFinishContext()\
1420  __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1421  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1422  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1423  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1424  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1425  #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1426  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1427  #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1428  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1429 #else
1430  #define __Pyx_RefNannyDeclarations
1431  #define __Pyx_RefNannySetupContext(name, acquire_gil)
1432  #define __Pyx_RefNannyFinishContext()
1433  #define __Pyx_INCREF(r) Py_INCREF(r)
1434  #define __Pyx_DECREF(r) Py_DECREF(r)
1435  #define __Pyx_GOTREF(r)
1436  #define __Pyx_GIVEREF(r)
1437  #define __Pyx_XINCREF(r) Py_XINCREF(r)
1438  #define __Pyx_XDECREF(r) Py_XDECREF(r)
1439  #define __Pyx_XGOTREF(r)
1440  #define __Pyx_XGIVEREF(r)
1441 #endif
1442 #define __Pyx_XDECREF_SET(r, v) do {\
1443  PyObject *tmp = (PyObject *) r;\
1444  r = v; __Pyx_XDECREF(tmp);\
1445  } while (0)
1446 #define __Pyx_DECREF_SET(r, v) do {\
1447  PyObject *tmp = (PyObject *) r;\
1448  r = v; __Pyx_DECREF(tmp);\
1449  } while (0)
1450 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1451 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1452 
1453 /* PyObjectGetAttrStr.proto */
1454 #if CYTHON_USE_TYPE_SLOTS
1455 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1456 #else
1457 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1458 #endif
1459 
1460 /* GetBuiltinName.proto */
1461 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1462 
1463 /* RaiseDoubleKeywords.proto */
1464 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1465 
1466 /* ParseKeywords.proto */
1467 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1468  PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1469  const char* function_name);
1470 
1471 /* RaiseArgTupleInvalid.proto */
1472 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1473  Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1474 
1475 /* PyThreadStateGet.proto */
1476 #if CYTHON_FAST_THREAD_STATE
1477 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1478 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1479 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1480 #else
1481 #define __Pyx_PyThreadState_declare
1482 #define __Pyx_PyThreadState_assign
1483 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1484 #endif
1485 
1486 /* PyErrFetchRestore.proto */
1487 #if CYTHON_FAST_THREAD_STATE
1488 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1489 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1490 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1491 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1492 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1493 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1494 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1495 #if CYTHON_COMPILING_IN_CPYTHON
1496 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1497 #else
1498 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1499 #endif
1500 #else
1501 #define __Pyx_PyErr_Clear() PyErr_Clear()
1502 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1503 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1504 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1505 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1506 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1507 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1508 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1509 #endif
1510 
1511 /* Profile.proto */
1512 #ifndef CYTHON_PROFILE
1513 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
1514  #define CYTHON_PROFILE 0
1515 #else
1516  #define CYTHON_PROFILE 1
1517 #endif
1518 #endif
1519 #ifndef CYTHON_TRACE_NOGIL
1520  #define CYTHON_TRACE_NOGIL 0
1521 #else
1522  #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1523  #define CYTHON_TRACE 1
1524  #endif
1525 #endif
1526 #ifndef CYTHON_TRACE
1527  #define CYTHON_TRACE 0
1528 #endif
1529 #if CYTHON_TRACE
1530  #undef CYTHON_PROFILE_REUSE_FRAME
1531 #endif
1532 #ifndef CYTHON_PROFILE_REUSE_FRAME
1533  #define CYTHON_PROFILE_REUSE_FRAME 0
1534 #endif
1535 #if CYTHON_PROFILE || CYTHON_TRACE
1536  #include "compile.h"
1537  #include "frameobject.h"
1538  #include "traceback.h"
1539 #if PY_VERSION_HEX >= 0x030b00a6
1540  #ifndef Py_BUILD_CORE
1541  #define Py_BUILD_CORE 1
1542  #endif
1543  #include "internal/pycore_frame.h"
1544 #endif
1545  #if CYTHON_PROFILE_REUSE_FRAME
1546  #define CYTHON_FRAME_MODIFIER static
1547  #define CYTHON_FRAME_DEL(frame)
1548  #else
1549  #define CYTHON_FRAME_MODIFIER
1550  #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1551  #endif
1552  #define __Pyx_TraceDeclarations\
1553  static PyCodeObject *__pyx_frame_code = NULL;\
1554  CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1555  int __Pyx_use_tracing = 0;
1556  #define __Pyx_TraceFrameInit(codeobj)\
1557  if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1558 #if PY_VERSION_HEX >= 0x030b00a2
1559  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1560  (unlikely((tstate)->cframe->use_tracing) &&\
1561  (!(check_tracing) || !(tstate)->tracing) &&\
1562  (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1563  #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
1564  #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
1565 #elif PY_VERSION_HEX >= 0x030a00b1
1566  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1567  (unlikely((tstate)->cframe->use_tracing) &&\
1568  (!(check_tracing) || !(tstate)->tracing) &&\
1569  (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1570  #define __Pyx_EnterTracing(tstate)\
1571  do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
1572  #define __Pyx_LeaveTracing(tstate)\
1573  do {\
1574  tstate->tracing--;\
1575  tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1576  || tstate->c_profilefunc != NULL);\
1577  } while (0)
1578 #else
1579  #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1580  (unlikely((tstate)->use_tracing) &&\
1581  (!(check_tracing) || !(tstate)->tracing) &&\
1582  (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1583  #define __Pyx_EnterTracing(tstate)\
1584  do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
1585  #define __Pyx_LeaveTracing(tstate)\
1586  do {\
1587  tstate->tracing--;\
1588  tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1589  || tstate->c_profilefunc != NULL);\
1590  } while (0)
1591 #endif
1592  #ifdef WITH_THREAD
1593  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1594  if (nogil) {\
1595  if (CYTHON_TRACE_NOGIL) {\
1596  PyThreadState *tstate;\
1597  PyGILState_STATE state = PyGILState_Ensure();\
1598  tstate = __Pyx_PyThreadState_Current;\
1599  if (__Pyx_IsTracing(tstate, 1, 1)) {\
1600  __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1601  }\
1602  PyGILState_Release(state);\
1603  if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1604  }\
1605  } else {\
1606  PyThreadState* tstate = PyThreadState_GET();\
1607  if (__Pyx_IsTracing(tstate, 1, 1)) {\
1608  __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1609  if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1610  }\
1611  }
1612  #else
1613  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1614  { PyThreadState* tstate = PyThreadState_GET();\
1615  if (__Pyx_IsTracing(tstate, 1, 1)) {\
1616  __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
1617  if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
1618  }\
1619  }
1620  #endif
1621  #define __Pyx_TraceException()\
1622  if (likely(!__Pyx_use_tracing)); else {\
1623  PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1624  if (__Pyx_IsTracing(tstate, 0, 1)) {\
1625  __Pyx_EnterTracing(tstate);\
1626  PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
1627  if (exc_info) {\
1628  if (CYTHON_TRACE && tstate->c_tracefunc)\
1629  tstate->c_tracefunc(\
1630  tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1631  tstate->c_profilefunc(\
1632  tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
1633  Py_DECREF(exc_info);\
1634  }\
1635  __Pyx_LeaveTracing(tstate);\
1636  }\
1637  }
1638  static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
1639  PyObject *type, *value, *traceback;
1640  __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1641  __Pyx_EnterTracing(tstate);
1642  if (CYTHON_TRACE && tstate->c_tracefunc)
1643  tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
1644  if (tstate->c_profilefunc)
1645  tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
1646  CYTHON_FRAME_DEL(frame);
1647  __Pyx_LeaveTracing(tstate);
1648  __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1649  }
1650  #ifdef WITH_THREAD
1651  #define __Pyx_TraceReturn(result, nogil)\
1652  if (likely(!__Pyx_use_tracing)); else {\
1653  if (nogil) {\
1654  if (CYTHON_TRACE_NOGIL) {\
1655  PyThreadState *tstate;\
1656  PyGILState_STATE state = PyGILState_Ensure();\
1657  tstate = __Pyx_PyThreadState_Current;\
1658  if (__Pyx_IsTracing(tstate, 0, 0)) {\
1659  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1660  }\
1661  PyGILState_Release(state);\
1662  }\
1663  } else {\
1664  PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1665  if (__Pyx_IsTracing(tstate, 0, 0)) {\
1666  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1667  }\
1668  }\
1669  }
1670  #else
1671  #define __Pyx_TraceReturn(result, nogil)\
1672  if (likely(!__Pyx_use_tracing)); else {\
1673  PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1674  if (__Pyx_IsTracing(tstate, 0, 0)) {\
1675  __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
1676  }\
1677  }
1678  #endif
1679  static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno);
1680  static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate, const char *funcname, const char *srcfile, int firstlineno);
1681 #else
1682  #define __Pyx_TraceDeclarations
1683  #define __Pyx_TraceFrameInit(codeobj)
1684  #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
1685  #define __Pyx_TraceException()
1686  #define __Pyx_TraceReturn(result, nogil)
1687 #endif
1688 #if CYTHON_TRACE
1689  static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame, int lineno) {
1690  int ret;
1691  PyObject *type, *value, *traceback;
1692  __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
1693  __Pyx_PyFrame_SetLineNumber(frame, lineno);
1694  __Pyx_EnterTracing(tstate);
1695  ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
1696  __Pyx_LeaveTracing(tstate);
1697  if (likely(!ret)) {
1698  __Pyx_ErrRestoreInState(tstate, type, value, traceback);
1699  } else {
1700  Py_XDECREF(type);
1701  Py_XDECREF(value);
1702  Py_XDECREF(traceback);
1703  }
1704  return ret;
1705  }
1706  #ifdef WITH_THREAD
1707  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1708  if (likely(!__Pyx_use_tracing)); else {\
1709  if (nogil) {\
1710  if (CYTHON_TRACE_NOGIL) {\
1711  int ret = 0;\
1712  PyThreadState *tstate;\
1713  PyGILState_STATE state = PyGILState_Ensure();\
1714  tstate = __Pyx_PyThreadState_Current;\
1715  if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1716  ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1717  }\
1718  PyGILState_Release(state);\
1719  if (unlikely(ret)) goto_error;\
1720  }\
1721  } else {\
1722  PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1723  if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1724  int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1725  if (unlikely(ret)) goto_error;\
1726  }\
1727  }\
1728  }
1729  #else
1730  #define __Pyx_TraceLine(lineno, nogil, goto_error)\
1731  if (likely(!__Pyx_use_tracing)); else {\
1732  PyThreadState* tstate = __Pyx_PyThreadState_Current;\
1733  if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
1734  int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
1735  if (unlikely(ret)) goto_error;\
1736  }\
1737  }
1738  #endif
1739 #else
1740  #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
1741 #endif
1742 
1743 /* PyDictVersioning.proto */
1744 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1745 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1746 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1747 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1748  (version_var) = __PYX_GET_DICT_VERSION(dict);\
1749  (cache_var) = (value);
1750 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1751  static PY_UINT64_T __pyx_dict_version = 0;\
1752  static PyObject *__pyx_dict_cached_value = NULL;\
1753  if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1754  (VAR) = __pyx_dict_cached_value;\
1755  } else {\
1756  (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1757  __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1758  }\
1759 }
1760 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1761 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1762 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1763 #else
1764 #define __PYX_GET_DICT_VERSION(dict) (0)
1765 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1766 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1767 #endif
1768 
1769 /* GetModuleGlobalName.proto */
1770 #if CYTHON_USE_DICT_VERSIONS
1771 #define __Pyx_GetModuleGlobalName(var, name) do {\
1772  static PY_UINT64_T __pyx_dict_version = 0;\
1773  static PyObject *__pyx_dict_cached_value = NULL;\
1774  (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1775  (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1776  __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1777 } while(0)
1778 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
1779  PY_UINT64_T __pyx_dict_version;\
1780  PyObject *__pyx_dict_cached_value;\
1781  (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1782 } while(0)
1783 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1784 #else
1785 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1786 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1787 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1788 #endif
1789 
1790 /* PyFunctionFastCall.proto */
1791 #if CYTHON_FAST_PYCALL
1792 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1793  __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1794 #if 1 || PY_VERSION_HEX < 0x030600B1
1795 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1796 #else
1797 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1798 #endif
1799 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1800  (sizeof(char [1 - 2*!(cond)]) - 1)
1801 #ifndef Py_MEMBER_SIZE
1802 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1803 #endif
1804 #if CYTHON_FAST_PYCALL
1805  static size_t __pyx_pyframe_localsplus_offset = 0;
1806  #include "frameobject.h"
1807 #if PY_VERSION_HEX >= 0x030b00a6
1808  #ifndef Py_BUILD_CORE
1809  #define Py_BUILD_CORE 1
1810  #endif
1811  #include "internal/pycore_frame.h"
1812 #endif
1813  #define __Pxy_PyFrame_Initialize_Offsets()\
1814  ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1815  (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1816  #define __Pyx_PyFrame_GetLocalsplus(frame)\
1817  (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1818 #endif // CYTHON_FAST_PYCALL
1819 #endif
1820 
1821 /* PyCFunctionFastCall.proto */
1822 #if CYTHON_FAST_PYCCALL
1823 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1824 #else
1825 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1826 #endif
1827 
1828 /* PyObjectCall.proto */
1829 #if CYTHON_COMPILING_IN_CPYTHON
1830 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1831 #else
1832 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1833 #endif
1834 
1835 /* RaiseTooManyValuesToUnpack.proto */
1836 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1837 
1838 /* RaiseNeedMoreValuesToUnpack.proto */
1839 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1840 
1841 /* IterFinish.proto */
1842 static CYTHON_INLINE int __Pyx_IterFinish(void);
1843 
1844 /* UnpackItemEndCheck.proto */
1845 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1846 
1847 /* GetItemInt.proto */
1848 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1849  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1850  __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1851  (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1852  __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1853 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1854  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1855  __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1856  (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1857 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1858  int wraparound, int boundscheck);
1859 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1860  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1861  __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1862  (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1863 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1864  int wraparound, int boundscheck);
1865 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1866 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1867  int is_list, int wraparound, int boundscheck);
1868 
1869 /* PyObjectCallMethO.proto */
1870 #if CYTHON_COMPILING_IN_CPYTHON
1871 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1872 #endif
1873 
1874 /* PyObjectCallNoArg.proto */
1875 #if CYTHON_COMPILING_IN_CPYTHON
1876 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1877 #else
1878 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1879 #endif
1880 
1881 /* PyObjectCallOneArg.proto */
1882 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1883 
1884 /* PyObjectCall2Args.proto */
1885 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1886 
1887 /* IncludeStringH.proto */
1888 #include <string.h>
1889 
1890 /* BytesEquals.proto */
1891 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1892 
1893 /* RaiseException.proto */
1894 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1895 
1896 /* SliceObject.proto */
1897 #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)\
1898  __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound)
1899 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(
1900  PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop,
1901  PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
1902  int has_cstart, int has_cstop, int wraparound);
1903 
1904 /* PyIntCompare.proto */
1905 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);
1906 
1907 /* MatrixMultiply.proto */
1908 #if PY_VERSION_HEX >= 0x03050000
1909  #define __Pyx_PyNumber_MatrixMultiply(x,y) PyNumber_MatrixMultiply(x,y)
1910  #define __Pyx_PyNumber_InPlaceMatrixMultiply(x,y) PyNumber_InPlaceMatrixMultiply(x,y)
1911 #else
1912 #define __Pyx_PyNumber_MatrixMultiply(x,y) __Pyx__PyNumber_MatrixMultiply(x, y, "@")
1913 static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y, const char* op_name);
1914 static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y);
1915 #endif
1916 
1917 /* ObjectGetItem.proto */
1918 #if CYTHON_USE_TYPE_SLOTS
1919 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1920 #else
1921 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1922 #endif
1923 
1924 /* SetItemInt.proto */
1925 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1926  (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1927  __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
1928  (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
1929  __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
1930 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
1931 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
1932  int is_list, int wraparound, int boundscheck);
1933 
1934 /* MemviewSliceInit.proto */
1935 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1936 #define __Pyx_MEMVIEW_DIRECT 1
1937 #define __Pyx_MEMVIEW_PTR 2
1938 #define __Pyx_MEMVIEW_FULL 4
1939 #define __Pyx_MEMVIEW_CONTIG 8
1940 #define __Pyx_MEMVIEW_STRIDED 16
1941 #define __Pyx_MEMVIEW_FOLLOW 32
1942 #define __Pyx_IS_C_CONTIG 1
1943 #define __Pyx_IS_F_CONTIG 2
1944 static int __Pyx_init_memviewslice(
1945  struct __pyx_memoryview_obj *memview,
1946  int ndim,
1947  __Pyx_memviewslice *memviewslice,
1948  int memview_is_new_reference);
1949 static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
1950  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1951 static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
1952  __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1953 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1954 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1955 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1956 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1957 static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
1958 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
1959 
1960 /* None.proto */
1961 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
1962 
1963 /* ArgTypeTest.proto */
1964 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1965  ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1966  __Pyx__ArgTypeTest(obj, type, name, exact))
1967 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
1968 
1969 /* UnicodeEquals.proto */
1970 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1971 
1972 /* StrEquals.proto */
1973 #if PY_MAJOR_VERSION >= 3
1974 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1975 #else
1976 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1977 #endif
1978 
1979 /* UnaryNegOverflows.proto */
1980 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1981  (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1982 
1983 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
1984 /* WriteUnraisableException.proto */
1985 static void __Pyx_WriteUnraisable(const char *name, int clineno,
1986  int lineno, const char *filename,
1987  int full_traceback, int nogil);
1988 
1989 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
1990 /* GetAttr.proto */
1991 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1992 
1993 /* decode_c_string_utf16.proto */
1994 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
1995  int byteorder = 0;
1996  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
1997 }
1998 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
1999  int byteorder = -1;
2000  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2001 }
2002 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
2003  int byteorder = 1;
2004  return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2005 }
2006 
2007 /* decode_c_string.proto */
2008 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2009  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2010  const char* encoding, const char* errors,
2011  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
2012 
2013 /* PyErrExceptionMatches.proto */
2014 #if CYTHON_FAST_THREAD_STATE
2015 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
2016 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
2017 #else
2018 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
2019 #endif
2020 
2021 /* GetAttr3.proto */
2022 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2023 
2024 /* RaiseNoneIterError.proto */
2025 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
2026 
2027 /* ExtTypeTest.proto */
2028 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
2029 
2030 /* GetTopmostException.proto */
2031 #if CYTHON_USE_EXC_INFO_STACK
2032 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2033 #endif
2034 
2035 /* SaveResetException.proto */
2036 #if CYTHON_FAST_THREAD_STATE
2037 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2038 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2039 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2040 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2041 #else
2042 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
2043 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
2044 #endif
2045 
2046 /* GetException.proto */
2047 #if CYTHON_FAST_THREAD_STATE
2048 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
2049 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2050 #else
2051 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2052 #endif
2053 
2054 /* SwapException.proto */
2055 #if CYTHON_FAST_THREAD_STATE
2056 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2057 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2058 #else
2059 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2060 #endif
2061 
2062 /* Import.proto */
2063 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
2064 
2065 /* FastTypeChecks.proto */
2066 #if CYTHON_COMPILING_IN_CPYTHON
2067 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2068 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2069 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2070 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2071 #else
2072 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2073 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2074 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2075 #endif
2076 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2077 
2078 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
2079 /* ListCompAppend.proto */
2080 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2081 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2082  PyListObject* L = (PyListObject*) list;
2083  Py_ssize_t len = Py_SIZE(list);
2084  if (likely(L->allocated > len)) {
2085  Py_INCREF(x);
2086  PyList_SET_ITEM(list, len, x);
2087  __Pyx_SET_SIZE(list, len + 1);
2088  return 0;
2089  }
2090  return PyList_Append(list, x);
2091 }
2092 #else
2093 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2094 #endif
2095 
2096 /* PyIntBinop.proto */
2097 #if !CYTHON_COMPILING_IN_PYPY
2098 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
2099 #else
2100 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2101  (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2102 #endif
2103 
2104 /* ListExtend.proto */
2105 static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2106 #if CYTHON_COMPILING_IN_CPYTHON
2107  PyObject* none = _PyList_Extend((PyListObject*)L, v);
2108  if (unlikely(!none))
2109  return -1;
2110  Py_DECREF(none);
2111  return 0;
2112 #else
2113  return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2114 #endif
2115 }
2116 
2117 /* ListAppend.proto */
2118 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2119 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2120  PyListObject* L = (PyListObject*) list;
2121  Py_ssize_t len = Py_SIZE(list);
2122  if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2123  Py_INCREF(x);
2124  PyList_SET_ITEM(list, len, x);
2125  __Pyx_SET_SIZE(list, len + 1);
2126  return 0;
2127  }
2128  return PyList_Append(list, x);
2129 }
2130 #else
2131 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2132 #endif
2133 
2134 /* AssertionsEnabled.proto */
2135 #define __Pyx_init_assertions_enabled()
2136 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
2137  #define __pyx_assertions_enabled() (1)
2138 #elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API)
2139  #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2140 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6
2141  static int __pyx_assertions_enabled_flag;
2142  #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
2143  #undef __Pyx_init_assertions_enabled
2144  static void __Pyx_init_assertions_enabled(void) {
2145  __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level;
2146  }
2147 #else
2148  #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2149 #endif
2150 
2151 /* PySequenceContains.proto */
2152 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
2153  int result = PySequence_Contains(seq, item);
2154  return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2155 }
2156 
2157 /* ImportFrom.proto */
2158 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2159 
2160 /* HasAttr.proto */
2161 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
2162 
2163 /* PyObject_GenericGetAttrNoDict.proto */
2164 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2165 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2166 #else
2167 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2168 #endif
2169 
2170 /* PyObject_GenericGetAttr.proto */
2171 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2172 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2173 #else
2174 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2175 #endif
2176 
2177 /* SetVTable.proto */
2178 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
2179 
2180 /* PyObjectGetAttrStrNoError.proto */
2181 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2182 
2183 /* SetupReduce.proto */
2184 static int __Pyx_setup_reduce(PyObject* type_obj);
2185 
2186 /* FetchCommonType.proto */
2187 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2188 
2189 /* CythonFunctionShared.proto */
2190 #define __Pyx_CyFunction_USED 1
2191 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2192 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2193 #define __Pyx_CYFUNCTION_CCLASS 0x04
2194 #define __Pyx_CyFunction_GetClosure(f)\
2195  (((__pyx_CyFunctionObject *) (f))->func_closure)
2196 #define __Pyx_CyFunction_GetClassObj(f)\
2197  (((__pyx_CyFunctionObject *) (f))->func_classobj)
2198 #define __Pyx_CyFunction_Defaults(type, f)\
2199  ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2200 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2201  ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2202 typedef struct {
2203  PyCFunctionObject func;
2204 #if PY_VERSION_HEX < 0x030500A0
2205  PyObject *func_weakreflist;
2206 #endif
2207  PyObject *func_dict;
2208  PyObject *func_name;
2209  PyObject *func_qualname;
2210  PyObject *func_doc;
2211  PyObject *func_globals;
2212  PyObject *func_code;
2213  PyObject *func_closure;
2214  PyObject *func_classobj;
2215  void *defaults;
2216  int defaults_pyobjects;
2217  size_t defaults_size; // used by FusedFunction for copying defaults
2218  int flags;
2219  PyObject *defaults_tuple;
2220  PyObject *defaults_kwdict;
2221  PyObject *(*defaults_getter)(PyObject *);
2222  PyObject *func_annotations;
2223 } __pyx_CyFunctionObject;
2224 static PyTypeObject *__pyx_CyFunctionType = 0;
2225 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2226 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2227  int flags, PyObject* qualname,
2228  PyObject *self,
2229  PyObject *module, PyObject *globals,
2230  PyObject* code);
2231 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2232  size_t size,
2233  int pyobjects);
2234 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2235  PyObject *tuple);
2236 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2237  PyObject *dict);
2238 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2239  PyObject *dict);
2240 static int __pyx_CyFunction_init(void);
2241 
2242 /* CythonFunction.proto */
2243 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2244  int flags, PyObject* qualname,
2245  PyObject *closure,
2246  PyObject *module, PyObject *globals,
2247  PyObject* code);
2248 
2249 /* CLineInTraceback.proto */
2250 #ifdef CYTHON_CLINE_IN_TRACEBACK
2251 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2252 #else
2253 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
2254 #endif
2255 
2256 /* CodeObjectCache.proto */
2257 typedef struct {
2258  PyCodeObject* code_object;
2259  int code_line;
2260 } __Pyx_CodeObjectCacheEntry;
2261 struct __Pyx_CodeObjectCache {
2262  int count;
2263  int max_count;
2264  __Pyx_CodeObjectCacheEntry* entries;
2265 };
2266 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2267 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2268 static PyCodeObject *__pyx_find_code_object(int code_line);
2269 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2270 
2271 /* AddTraceback.proto */
2272 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2273  int py_line, const char *filename);
2274 
2275 #if PY_MAJOR_VERSION < 3
2276  static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
2277  static void __Pyx_ReleaseBuffer(Py_buffer *view);
2278 #else
2279  #define __Pyx_GetBuffer PyObject_GetBuffer
2280  #define __Pyx_ReleaseBuffer PyBuffer_Release
2281 #endif
2282 
2283 
2284 /* BufferStructDeclare.proto */
2285 typedef struct {
2286  Py_ssize_t shape, strides, suboffsets;
2287 } __Pyx_Buf_DimInfo;
2288 typedef struct {
2289  size_t refcount;
2290  Py_buffer pybuffer;
2291 } __Pyx_Buffer;
2292 typedef struct {
2293  __Pyx_Buffer *rcbuffer;
2294  char *data;
2295  __Pyx_Buf_DimInfo diminfo[8];
2296 } __Pyx_LocalBuf_ND;
2297 
2298 /* MemviewSliceIsContig.proto */
2299 static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
2300 
2301 /* OverlappingSlices.proto */
2302 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2303  __Pyx_memviewslice *slice2,
2304  int ndim, size_t itemsize);
2305 
2306 /* Capsule.proto */
2307 static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
2308 
2309 /* GCCDiagnostics.proto */
2310 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2311 #define __Pyx_HAS_GCC_DIAGNOSTIC
2312 #endif
2313 
2314 /* IsLittleEndian.proto */
2315 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
2316 
2317 /* BufferFormatCheck.proto */
2318 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
2319 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2320  __Pyx_BufFmt_StackElem* stack,
2321  __Pyx_TypeInfo* type);
2322 
2323 /* TypeInfoCompare.proto */
2324 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2325 
2326 /* MemviewSliceValidateAndInit.proto */
2327 static int __Pyx_ValidateAndInit_memviewslice(
2328  int *axes_specs,
2329  int c_or_f_flag,
2330  int buf_flags,
2331  int ndim,
2332  __Pyx_TypeInfo *dtype,
2333  __Pyx_BufFmt_StackElem stack[],
2334  __Pyx_memviewslice *memviewslice,
2335  PyObject *original_obj);
2336 
2337 /* ObjectToMemviewSlice.proto */
2338 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__float(PyObject *, int writable_flag);
2339 
2340 /* ObjectToMemviewSlice.proto */
2341 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__double(PyObject *, int writable_flag);
2342 
2343 /* ObjectToMemviewSlice.proto */
2344 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *, int writable_flag);
2345 
2346 /* ObjectToMemviewSlice.proto */
2347 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *, int writable_flag);
2348 
2349 /* MemviewSliceCopyTemplate.proto */
2350 static __Pyx_memviewslice
2351 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
2352  const char *mode, int ndim,
2353  size_t sizeof_dtype, int contig_flag,
2354  int dtype_is_object);
2355 
2356 /* CIntToPy.proto */
2357 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2358 
2359 /* CIntFromPy.proto */
2360 static CYTHON_INLINE LongIndexType __Pyx_PyInt_As_LongIndexType(PyObject *);
2361 
2362 /* CIntFromPy.proto */
2363 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2364 
2365 /* CIntToPy.proto */
2366 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2367 
2368 /* CIntFromPy.proto */
2369 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2370 
2371 /* CIntFromPy.proto */
2372 static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
2373 
2374 /* CheckBinaryVersion.proto */
2375 static int __Pyx_check_binary_version(void);
2376 
2377 /* FunctionImport.proto */
2378 static int __Pyx_ImportFunction_0_29_36(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2379 
2380 /* InitStrings.proto */
2381 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2382 
2383 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
2384 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
2385 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
2386 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
2387 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value); /* proto*/
2388 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
2389 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2390 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2391 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
2392 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
2393 
2394 /* Module declarations from 'imate._definitions.types' */
2395 
2396 /* Module declarations from 'imate._c_basic_algebra.c_vector_operations' */
2397 
2398 /* Module declarations from 'imate._c_basic_algebra' */
2399 
2400 /* Module declarations from 'imate._linear_algebra.orthogonalization' */
2401 static void (*__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2402 static void (*__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2403 static void (*__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors)(long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2404 
2405 /* Module declarations from 'imate._linear_algebra.random_vectors' */
2406 static void (*__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2407 static void (*__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2408 static void (*__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors)(long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const ); /*proto*/
2409 
2410 /* Module declarations from 'imate._linear_algebra' */
2411 
2412 /* Module declarations from 'imate.traceinv._hutchinson_method' */
2413 static PyTypeObject *__pyx_array_type = 0;
2414 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2415 static PyTypeObject *__pyx_memoryview_type = 0;
2416 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2417 static PyObject *generic = 0;
2418 static PyObject *strided = 0;
2419 static PyObject *indirect = 0;
2420 static PyObject *contiguous = 0;
2421 static PyObject *indirect_contiguous = 0;
2422 static int __pyx_memoryview_thread_locks_used;
2423 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2424 static float __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2425 static double __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/
2426 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
2427 static void *__pyx_align_pointer(void *, size_t); /*proto*/
2428 static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
2429 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
2430 static PyObject *_unellipsify(PyObject *, int); /*proto*/
2431 static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
2432 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
2433 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int *, Py_ssize_t, Py_ssize_t, Py_ssize_t, int, int, int, int); /*proto*/
2434 static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
2435 static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
2436 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
2437 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2438 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2439 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
2440 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
2441 static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
2442 static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
2443 static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
2444 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
2445 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
2446 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
2447 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
2448 static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
2449 static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
2450 static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
2451 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
2452 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
2453 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
2454 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2455 static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
2456 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
2457 static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
2458 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
2459 static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
2460 static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), { 0 }, 0, 'R', 0, 0 };
2461 #define __Pyx_MODULE_NAME "imate.traceinv._hutchinson_method"
2462 extern int __pyx_module_is_main_imate__traceinv___hutchinson_method;
2463 int __pyx_module_is_main_imate__traceinv___hutchinson_method = 0;
2464 
2465 /* Implementation of 'imate.traceinv._hutchinson_method' */
2466 static PyObject *__pyx_builtin_TypeError;
2467 static PyObject *__pyx_builtin_range;
2468 static PyObject *__pyx_builtin_RuntimeError;
2469 static PyObject *__pyx_builtin_ValueError;
2470 static PyObject *__pyx_builtin_MemoryError;
2471 static PyObject *__pyx_builtin_enumerate;
2472 static PyObject *__pyx_builtin_Ellipsis;
2473 static PyObject *__pyx_builtin_id;
2474 static PyObject *__pyx_builtin_IndexError;
2475 static const char __pyx_k_A[] = "A";
2476 static const char __pyx_k_B[] = "B";
2477 static const char __pyx_k_C[] = "C";
2478 static const char __pyx_k_E[] = "E";
2479 static const char __pyx_k_F[] = "F";
2480 static const char __pyx_k_O[] = "O";
2481 static const char __pyx_k_T[] = "T";
2482 static const char __pyx_k_c[] = "c";
2483 static const char __pyx_k_i[] = "i";
2484 static const char __pyx_k_p[] = "p";
2485 static const char __pyx_k_BE[] = "BE";
2486 static const char __pyx_k_cE[] = "cE";
2487 static const char __pyx_k_id[] = "id";
2488 static const char __pyx_k_AtA[] = "AtA";
2489 static const char __pyx_k_OpE[] = "OpE";
2490 static const char __pyx_k_abs[] = "abs";
2491 static const char __pyx_k_eps[] = "eps";
2492 static const char __pyx_k_gen[] = "gen";
2493 static const char __pyx_k_nan[] = "nan";
2494 static const char __pyx_k_new[] = "__new__";
2495 static const char __pyx_k_nnz[] = "nnz";
2496 static const char __pyx_k_obj[] = "obj";
2497 static const char __pyx_k_base[] = "base";
2498 static const char __pyx_k_dict[] = "__dict__";
2499 static const char __pyx_k_gram[] = "gram";
2500 static const char __pyx_k_info[] = "info";
2501 static const char __pyx_k_main[] = "__main__";
2502 static const char __pyx_k_mode[] = "mode";
2503 static const char __pyx_k_name[] = "name";
2504 static const char __pyx_k_ndim[] = "ndim";
2505 static const char __pyx_k_pack[] = "pack";
2506 static const char __pyx_k_plot[] = "plot";
2507 static const char __pyx_k_seed[] = "seed";
2508 static const char __pyx_k_size[] = "size";
2509 static const char __pyx_k_step[] = "step";
2510 static const char __pyx_k_stop[] = "stop";
2511 static const char __pyx_k_test[] = "__test__";
2512 static const char __pyx_k_time[] = "time";
2513 static const char __pyx_k_ASCII[] = "ASCII";
2514 static const char __pyx_k_class[] = "__class__";
2515 static const char __pyx_k_dtype[] = "dtype";
2516 static const char __pyx_k_empty[] = "empty";
2517 static const char __pyx_k_error[] = "error";
2518 static const char __pyx_k_finfo[] = "finfo";
2519 static const char __pyx_k_flags[] = "flags";
2520 static const char __pyx_k_numpy[] = "numpy";
2521 static const char __pyx_k_order[] = "order";
2522 static const char __pyx_k_range[] = "range";
2523 static const char __pyx_k_scipy[] = "scipy";
2524 static const char __pyx_k_shape[] = "shape";
2525 static const char __pyx_k_start[] = "start";
2526 static const char __pyx_k_trace[] = "trace";
2527 static const char __pyx_k_zeros[] = "zeros";
2528 static const char __pyx_k_AinvpE[] = "AinvpE";
2529 static const char __pyx_k_device[] = "device";
2530 static const char __pyx_k_encode[] = "encode";
2531 static const char __pyx_k_format[] = "format";
2532 static const char __pyx_k_import[] = "__import__";
2533 static const char __pyx_k_matmul[] = "__matmul__";
2534 static const char __pyx_k_matrix[] = "matrix";
2535 static const char __pyx_k_method[] = "method";
2536 static const char __pyx_k_name_2[] = "__name__";
2537 static const char __pyx_k_pickle[] = "pickle";
2538 static const char __pyx_k_reduce[] = "__reduce__";
2539 static const char __pyx_k_solver[] = "solver";
2540 static const char __pyx_k_sparse[] = "sparse";
2541 static const char __pyx_k_square[] = "square";
2542 static const char __pyx_k_struct[] = "struct";
2543 static const char __pyx_k_unpack[] = "unpack";
2544 static const char __pyx_k_update[] = "update";
2545 static const char __pyx_k_density[] = "density";
2546 static const char __pyx_k_float32[] = "float32";
2547 static const char __pyx_k_float64[] = "float64";
2548 static const char __pyx_k_fortran[] = "fortran";
2549 static const char __pyx_k_get_nnz[] = "get_nnz";
2550 static const char __pyx_k_imatmul[] = "__imatmul__";
2551 static const char __pyx_k_memview[] = "memview";
2552 static const char __pyx_k_rmatmul[] = "__rmatmul__";
2553 static const char __pyx_k_samples[] = "samples";
2554 static const char __pyx_k_verbose[] = "verbose";
2555 static const char __pyx_k_version[] = "version";
2556 static const char __pyx_k_Ellipsis[] = "Ellipsis";
2557 static const char __pyx_k_exponent[] = "exponent";
2558 static const char __pyx_k_getstate[] = "__getstate__";
2559 static const char __pyx_k_itemsize[] = "itemsize";
2560 static const char __pyx_k_pyx_type[] = "__pyx_type";
2561 static const char __pyx_k_setstate[] = "__setstate__";
2562 static const char __pyx_k_TypeError[] = "TypeError";
2563 static const char __pyx_k_converged[] = "converged";
2564 static const char __pyx_k_cpu_count[] = "cpu_count";
2565 static const char __pyx_k_data_type[] = "data_type";
2566 static const char __pyx_k_enumerate[] = "enumerate";
2567 static const char __pyx_k_pyx_state[] = "__pyx_state";
2568 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2569 static const char __pyx_k_version_2[] = "__version__";
2570 static const char __pyx_k_IndexError[] = "IndexError";
2571 static const char __pyx_k_ValueError[] = "ValueError";
2572 static const char __pyx_k_error_atol[] = "error_atol";
2573 static const char __pyx_k_error_rtol[] = "error_rtol";
2574 static const char __pyx_k_hutchinson[] = "hutchinson";
2575 static const char __pyx_k_isspmatrix[] = "isspmatrix";
2576 static const char __pyx_k_pyx_result[] = "__pyx_result";
2577 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2578 static const char __pyx_k_solver_tol[] = "solver_tol";
2579 static const char __pyx_k_MemoryError[] = "MemoryError";
2580 static const char __pyx_k_PickleError[] = "PickleError";
2581 static const char __pyx_k_convergence[] = "convergence";
2582 static const char __pyx_k_get_density[] = "get_density";
2583 static const char __pyx_k_num_threads[] = "num_threads";
2584 static const char __pyx_k_return_info[] = "return_info";
2585 static const char __pyx_k_vector_size[] = "vector_size";
2586 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2587 static const char __pyx_k_memoryview_E[] = "memoryview_E";
2588 static const char __pyx_k_num_outliers[] = "num_outliers";
2589 static const char __pyx_k_operator_dot[] = "_operator_dot";
2590 static const char __pyx_k_perf_counter[] = "perf_counter";
2591 static const char __pyx_k_process_time[] = "process_time";
2592 static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
2593 static const char __pyx_k_samples_mean[] = "samples_mean";
2594 static const char __pyx_k_scipy_sparse[] = "scipy.sparse";
2595 static const char __pyx_k_stringsource[] = "stringsource";
2596 static const char __pyx_k_alg_wall_time[] = "alg_wall_time";
2597 static const char __pyx_k_assume_matrix[] = "assume_matrix";
2598 static const char __pyx_k_cpu_proc_time[] = "cpu_proc_time";
2599 static const char __pyx_k_linear_solver[] = "linear_solver";
2600 static const char __pyx_k_num_inquiries[] = "num_inquiries";
2601 static const char __pyx_k_orthogonalize[] = "orthogonalize";
2602 static const char __pyx_k_print_summary[] = "print_summary";
2603 static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
2604 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2605 static const char __pyx_k_tot_wall_time[] = "tot_wall_time";
2606 static const char __pyx_k_absolute_error[] = "absolute_error";
2607 static const char __pyx_k_data_type_name[] = "data_type_name";
2608 static const char __pyx_k_linear_algebra[] = "_linear_algebra";
2609 static const char __pyx_k_relative_error[] = "relative_error";
2610 static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
2611 static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
2612 static const char __pyx_k_check_arguments[] = "check_arguments";
2613 static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
2614 static const char __pyx_k_max_num_samples[] = "max_num_samples";
2615 static const char __pyx_k_min_num_samples[] = "min_num_samples";
2616 static const char __pyx_k_multiprocessing[] = "multiprocessing";
2617 static const char __pyx_k_num_cpu_threads[] = "num_cpu_threads";
2618 static const char __pyx_k_num_gpu_devices[] = "num_gpu_devices";
2619 static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
2620 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2621 static const char __pyx_k_confidence_level[] = "confidence_level";
2622 static const char __pyx_k_num_samples_used[] = "num_samples_used";
2623 static const char __pyx_k_plot_convergence[] = "plot_convergence";
2624 static const char __pyx_k_average_estimates[] = "average_estimates";
2625 static const char __pyx_k_check_convergence[] = "check_convergence";
2626 static const char __pyx_k_convergence_tools[] = "_convergence_tools";
2627 static const char __pyx_k_hutchinson_method[] = "hutchinson_method";
2628 static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
2629 static const char __pyx_k_AtA_cannot_be_None[] = "\"AtA\" cannot be None.";
2630 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2631 static const char __pyx_k_get_data_type_name[] = "get_data_type_name";
2632 static const char __pyx_k_init_alg_wall_time[] = "init_alg_wall_time";
2633 static const char __pyx_k_init_cpu_proc_time[] = "init_cpu_proc_time";
2634 static const char __pyx_k_init_tot_wall_time[] = "init_tot_wall_time";
2635 static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
2636 static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
2637 static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
2638 static const char __pyx_k_num_processed_samples[] = "num_processed_samples";
2639 static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
2640 static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
2641 static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
2642 static const char __pyx_k_hutchinson_method_float[] = "_hutchinson_method_float";
2643 static const char __pyx_k_num_gpu_multiprocessors[] = "num_gpu_multiprocessors";
2644 static const char __pyx_k_samples_processed_order[] = "samples_processed_order";
2645 static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
2646 static const char __pyx_k_hutchinson_method_double[] = "_hutchinson_method_double";
2647 static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
2648 static const char __pyx_k_hutchinson_method_line_37[] = "hutchinson_method (line 37)";
2649 static const char __pyx_k_processed_samples_indices[] = "processed_samples_indices";
2650 static const char __pyx_k_outlier_significance_level[] = "outlier_significance_level";
2651 static const char __pyx_k_hutchinson_method_utilities[] = "_hutchinson_method_utilities";
2652 static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
2653 static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
2654 static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
2655 static const char __pyx_k_Trace_of_matrix_or_linear_opera[] = "\n Trace of matrix or linear operator using stochastic Lanczos quadrature\n method.\n\n If `C` is `None`, given the matrices :math:`\\mathbf{A}` and\n :math:`\\mathbf{B}` and the integer exponent :math:`p`, the following is\n computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\right).\n\n If `B` is `None`, it is assumed that :math:`\\mathbf{B}` is the identity\n matrix.\n\n If `C` is not `None`, given the matrix :math:`\\mathbf{C}`, the following\n is instead computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\mathbf{C}\n \\mathbf{A}^{-p} \\right).\n\n If ``gram`` is `True`, then :math:`\\mathbf{A}` in the above is replaced by\n the Gramian matrix :math:`\\mathbf{A}^{\\intercal} \\mathbf{A}`. Namely, if\n `C` is `None`:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right),\n\n and if `C` is not `None`,\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\mathbf{C}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right).\n\n Parameters\n ----------\n\n A : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. If ``gram`` is `True`, the matrix can be\n non-square.\n\n .. note::\n\n In the Hutchinson method, the matrix cannot be a type of\n :class:`Matrix` or :class:`imate.AffineMatrixFunction` classes.\n\n gram : bool, default=False\n If `True`, the trace of the Gramian matrix,\n :math:`(\\mathbf{A}^{\\intercal}\\mathbf{A})^p`, is computed. The\n Gramian matrix itself is not directly computed. If `False`, the\n trace of :math:`\\mathbf{A}^p` is computed.\n\n p : float, default=1.0\n The integer exponent :math:`p` in :math:`\\mathbf{A}^{-p}`.\n\n return_info : bool, default=False\n If `True`, this functio""n also returns a dictionary containing\n information about the inner computation, such as process time,\n algorithm settings, etc.\n\n B : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `B` should be the same size and type of `A`.\n if `B` is `None`, it is assumed that `B` is the identity matrix.\n\n C : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `C` should be the same size and type of `A`.\n\n assume_matrix : str {'gen', 'sym', 'pos', 'sym_pos'}, default: 'gen'\n Type of matrix `A`:\n\n * ``gen`` assumes `A` is a generic matrix.\n * ``sym`` assumes `A` is symmetric.\n * ``pos`` assumes `A` is positive-definite.\n * ``sym_pos`` assumes `A` is symmetric and positive-definite.\n\n min_num_samples : int, default=10\n The minimum number of Monte-Carlo samples. If the convergence criterion\n is reached before finishing the minimum number of iterations, the\n iterations are forced to continue till the minimum number of iterations\n is finished. This value should be smaller than\n ``maximum_num_samples``.\n\n max_num_samples : int, default=50\n The maximum number of Monte-Carlo samples. If the convergence criterion\n is not reached by the maximum number of iterations, the iterations are\n forced to stop. This value should be larger than\n ``minimum_num_samples``.\n\n error_atol : float, default=None\n Tolerance of the absolute error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n error_rtol : float, default=None\n Tolerance of the relative error of con""vergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n confidence_level : float, default=0.95\n Confidence level of error, which is a number between `0` and `1`. The\n error of convergence of the population of samples is defined by their\n standard deviation times the Z-score, which depends on the confidence\n level. See notes below for details.\n\n outlier_significance_level : float, default=0.001\n One minus the confidence level of the uncertainty of the outliers of\n the output samples. This is a number between `0` and `1`.\n\n solver_tol : float, default=1e-6\n Tolerance of solving linear system.\n\n orthogonalize : int, default=0\n If `True`, it orthogonalizes the set of random vectors used for\n Monte-Carlo sampling. This might lead to a better estimation of the\n output.\n\n seed : int, default=None\n A non-negative integer to be used as seed to initiate the generation of\n sequences of peudo-random numbers in the algorithm. This is useful to\n make the result of the randomized algorithm to be reproducible. If\n ``None`` or a negative integer is given, the given seed value is\n ignored and the current processor time is used as the seed to initiate\n he generation random number sequences. In this case, the result is not\n reproducible, rather, is pseudo-random.\n\n num_threads : int, default=0\n Number of processor threads to employ for parallel computation on CPU.\n If set to `0` or a number larger than the available number of threads,\n all threads of the processor are used. The p""arallelization is performed\n over the Monte-Carlo iterations.\n\n verbose : bool, default=False\n Prints extra information about the computations.\n\n plot : bool, default=False\n Plots convergence of samples. To this end, `matplotlib` package should\n be installed. If no display is available (such as running this code on\n remote machines), the plots are saved as an `SVG` file in the current\n directory.\n\n Returns\n -------\n\n traceinv : float or numpy.array\n Trace of inverse of matrix.\n\n info : dict\n (Only if ``return_info`` is `True`) A dictionary of information with\n the following.\n\n * ``matrix``:\n * ``data_type``: `str`, {`float32`, `float64`, `float128`}. Type of\n the matrix data.\n * ``gram``: `bool`, whether the matrix `A` or its Gramian is\n considered.\n * ``exponent``: `float`, the exponent `p` in :math:`\\mathbf{A}^p`.\n * ``assume_matrix``: `str`, {`gen`, `sym`, `pos`, `sym_pos`},\n determines the type of matrix `A`.\n * ``size``: (int, int) The size of matrix `A`.\n * ``sparse``: `bool`, whether the matrix `A` is sparse or dense.\n * ``nnz``: `int`, if `A` is sparse, the number of non-zero elements\n of `A`.\n * ``density``: `float`, if `A` is sparse, the density of `A`, which\n is the `nnz` divided by size squared.\n * ``num_inquiries``: `int`, the size of inquiries of each parameter\n of the linear operator `A`. If `A` is a matrix, this is always\n `1`. If `A` is a type of :class:`AffineMatrixFunction`, this\n value is the number of :math:`t_i` parameters.\n\n * ``convergence``:\n * ``converged``: `bool`, whether the Monte-Carlo sampling\n converged.\n * ``min_num_samples``: `int`, the minimum number of Monte-C""arlo\n iterations.\n * ``max_num_samples``: `int`, the maximum number of Monte-Carlo\n iterations.\n * ``num_outliers``: `int`, number of outliers found during search\n for outliers among the array of output.\n * ``num_samples_used``: `int`, number of Monte-Carlo samples used\n to produce the output. This is the total number of iterations\n minus the number of outliers.\n * ``samples``: `array` [`float`], an array of the size\n `max_num_samples`. The first few entries (`num_samples_used`) of\n this array are the output results of the Monte-Carlo sampling.\n The average of these samples is the final result. The rest of\n this array is `nan`.\n * ``samples_mean``: `float`, mean of the `samples` array, excluding\n the `nan` values.\n * ``samples_processed_order``: `array` [`int`], in parallel\n processing, samples are processed in non-sequential order. This\n array, which has the same size as `samples`, keeps track of the\n order in which each sample is processed.\n\n * ``error``:\n * ``absolute_error``: `float`, the absolute error of the\n convergence of samples.\n * ``confidence_level``: `float`, the confidence level used to\n calculate the error from standard deviation of samples.\n * ``error_atol``: `float`, the tolerance of absolute error of the\n convergence of samples.\n * ``error_rtol``: `float`, the tolerance of relative error of the\n convergence of samples.\n * ``outlier_significance_level``: `float`, the significance level\n used to determine the outliers in samples.\n * ``relative_error``: `float`, the relative error of the\n convergence of samples.\n\n * ``device``:""\n * ``num_cpu_threads``: `int`, number of CPU threads used in shared\n memory parallel processing.\n * ``num_gpu_devices``: `int`, number of GPU devices used in the\n multi-GPU (GPU farm) computation.\n * ``num_gpu_multiprocessors``: `int`, number of GPU\n multi-processors.\n * ``num_gpu_threads_per_multiprocessor``: `int`, number of GPU\n threads on each GPU multi-processor.\n\n * ``time``:\n * ``tot_wall_time``: `float`, total elapsed time of computation.\n * ``alg_wall_time``: `float`, elapsed time of computation during\n only the algorithm execution.\n * ``cpu_proc_time``: `float`, the CPU processing time of\n computation.\n\n * ``solver``:\n * ``version``: `str`, version of imate.\n * ``method``: 'hutchinson'.\n * ``solver_tol``: `float`, tolerance of solving linear system.\n * ``orthogonalize``: `bool`, orthogonalization flag.\n * ``seed`` : `int`, seed value for random number generation.\n\n Raises\n ------\n\n ImportError\n If the package has not been compiled with GPU support, but ``gpu`` is\n set to `True`. To resolve the issue, set ``gpu`` to `False` to be able\n to use the existing installation. Alternatively, export the\n environment variable ``USE_CUDA=1`` and recompile the source code of\n the package.\n\n See Also\n --------\n\n imate.logdet\n imate.trace\n imate.schatten\n\n Notes\n -----\n\n **Computational Complexity:**\n\n This method uses the Hutchinson, which is a randomized algorithm. The\n computational complexity of this method is\n\n .. math::\n\n \\mathcal{O}((\\rho n^2s),\n\n where :math:`n` is the matrix size, :math:`\\rho` is the density of\n sparse matrix (for dense matrix, :math:`\\rho=1`), and :math:`s` is the\n number o""f samples (set with ``min_num_samples`` and ``max_num_samples``).\n\n This method can be used on very large matrices (:math:`n > 2^{12}`). The\n solution is an approximation.\n\n **Convergence criterion:**\n\n Let :math:`n_{\\min}` and :math:`n_{\\max}` be the minimum and maximum\n number of iterations respectively defined by ``min_num_samples`` and\n ``max_num_samples``. The iterations terminate at\n :math:`n_{\\min} \\leq i \\leq n_{\\max}` where :math:`i` is the\n iteration counter. The iterations stop earlier at :math:`i < n_{\\max}` if\n the convergence error of the mean of the samples is satisfied, as follows.\n\n Suppose :math:`s(j)` and :math:`\\sigma(i)` are respectively the mean and\n standard deviation of samples after :math:`j` iterations. The error of\n convergence, :math:`e(j)`, is defined by\n\n .. math::\n\n e(j) = \\frac{\\sigma(j)}{\\sqrt{j}} Z\n\n where :math:`Z` is the Z-score defined by\n\n .. math::\n\n Z = \\sqrt{2} \\mathrm{erf}^{-1}(\\phi).\n\n In the above, :math:`\\phi` is the confidence level and set by\n ``confidence_level`` argument, and :math:`\\mathrm{erf}^{-1}` is the\n inverse error function. A confidence level of 95%, for instance, means that\n the Z-score is 1.96, which means the confidence interval is\n :math:`\\pm 1.96 \\sigma`.\n\n The termination criterion is\n\n .. math::\n\n e(j) < \\epsilon_a + s(j) \\epsilon_r,\n\n where :math:`\\epsilon_{a}` and :math:`\\epsilon_r` are the absolute and\n relative error tolerances respectively, and they are set by ``error_atol``\n and ``error_rtol``.\n\n **Plotting:**\n\n If ``plot`` is set to `True`, it plots the convergence of samples and their\n relative error.\n\n * If no graphical backend exists (such as running the code on a remote\n server or manually disabling the X11 backend), the plot will not be\n shown, rather, it will be saved as an ``svg`` file in the current""\n directory.\n * If the executable ``latex`` is available on ``PATH``, the plot is\n rendered using :math:`\\rm\\LaTeX` and it may take slightly longer to\n produce the plot.\n * If :math:`\\rm\\LaTeX` is not installed, it uses any available San-Serif\n font to render the plot.\n\n To manually disable interactive plot display and save the plot as\n ``svg`` instead, add the following at the very beginning of your code\n before importing :mod:`imate`:\n\n .. code-block:: python\n\n >>> import os\n >>> os.environ['IMATE_NO_DISPLAY'] = 'True'\n\n References\n ----------\n\n * `Ubaru, S., Chen, J., and Saad, Y. (2017)\n <https://www-users.cs.umn.edu/~saad/PDF/ys-2016-04.pdf>`_,\n Fast Estimation of :math:`\\mathrm{tr}(F(A))` Via Stochastic Lanczos\n Quadrature, SIAM J. Matrix Anal. Appl., 38(4), 1075-1099.\n\n Examples\n --------\n\n **Basic Usage:**\n\n Compute the trace of :math:`\\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Import packages\n >>> from imate import toeplitz, traceinv\n\n >>> # Generate a sample matrix\n >>> A = toeplitz(2, 1, size=100)\n\n >>> # Compute trace of inverse\n >>> traceinv(A, p=2, method='hutchinson')\n 24.73726368966402\n\n Compute the trace of :math:`(\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson')\n 17.751659383784748\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another sample matrix\n >>> B = toeplitz(4, 3, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B)\n 99.8817360381704\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2} \\mathbf{C}\n \\mathbf{A}^{-2}`:\n\n .. code-block:: python""\n\n >>> # Generate another sample matrix\n >>> C = toeplitz(5, 4, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B, C=C)\n 124.45436379980006\n\n Compute the trace of :math:`\\mathbf{B} (\\mathbf{A}^{\\intercal}\n \\mathbf{A})^{-2} \\mathbf{C} (\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson', B=B, C=C)\n 5.517453125230929\n\n **Verbose output:**\n\n By setting ``verbose`` to `True`, useful info about the process is\n printed.\n\n .. literalinclude:: ../_static/data/imate.traceinv.hutchinson-verbose.txt\n :language: python\n\n **Output information:**\n\n Print information about the inner computation:\n\n .. code-block:: python\n\n >>> ti, info = traceinv(A, method='hutchinson', return_info=True)\n >>> print(ti)\n 50.059307947603585\n\n >>> # Print dictionary neatly using pprint\n >>> from pprint import pprint\n >>> pprint(info)\n {\n 'matrix': {\n 'assume_matrix': 'gen',\n 'data_type': b'float64',\n 'density': 0.0199,\n 'exponent': 1,\n 'gram': False,\n 'nnz': 199,\n 'num_inquiries': 1,\n 'size': (100, 100),\n 'sparse': True\n },\n 'convergence': {\n 'converged': False,\n 'max_num_samples': 50,\n 'min_num_samples': 10,\n 'num_outliers': 0,\n 'num_samples_used': 50,\n 'samples': array([52.237154, ..., 51.37932704]),\n 'samples_mean': 50.059307947603585,\n 'samples_processed_order': array([ 0, ..., 49])\n },\n 'error': {\n 'absolute_error': 0.8111""131801161796,\n 'confidence_level': 0.95,\n 'error_atol': 0.0,\n 'error_rtol': 0.01,\n 'outlier_significance_level': 0.001,\n 'relative_error': 0.016203044216375525\n },\n 'solver': {\n 'method': 'hutchinson',\n 'orthogonalize': True,\n 'seed': None,\n 'solver_tol': 1e-06,\n 'version': '0.16.0'\n },\n 'device': {\n 'num_cpu_threads': 8,\n 'num_gpu_devices': 0,\n 'num_gpu_multiprocessors': 0,\n 'num_gpu_threads_per_multiprocessor': 0\n },\n 'time': {\n 'alg_wall_time': 0.03236744087189436,\n 'cpu_proc_time': 0.047695197999999994,\n 'tot_wall_time': 0.033352302853018045\n }\n }\n\n **Large matrix:**\n\n Compute the trace of :math:`\\mathbf{A}^{-1}` for a very large sparse\n matrix using at least `100` samples.\n\n .. code-block:: python\n :emphasize-lines: 5, 6, 7\n\n >>> # Create a symmetric positive-definite matrix of size one million.\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n\n >>> # Approximate trace using hutchinson method\n >>> ti, info = traceinv(A, method='hutchinson', solver_tol=1e-4,\n ... assume_matrix='sym_pos', min_num_samples=100,\n ... max_num_samples=200, return_info=True)\n >>> print(ti)\n 333292.3226031165\n\n >>> # Find the time it took to compute the above\n >>> print(info['time'])\n {\n 'tot_wall_time': 175.93423152901232,\n 'alg_wall_time': 119.86316476506181,\n 'cpu_proc_time': 572.180877451\n }\n\n Compare the result of the above approximation with the exact solution of\n the trace using the analytic relation for Toeplitz matrix. Se""e\n :func:`imate.sample_matrices.toeplitz_traceinv` for details.\n\n .. code-block:: python\n\n >>> from imate.sample_matrices import toeplitz_traceinv\n >>> toeplitz_traceinv(2, 1, size=1000000, gram=True)\n 333333.2222222222\n\n It can be seen that the error of approximation is :math:`0.012 \\%`. This\n accuracy is remarkable considering that the computation on such a large\n matrix took on 119 seconds. Computing the trace of such a large matrix\n using any of the exact methods (such as ``exact`` or ``eigenvalue``) is\n infeasible.\n\n **Plotting:**\n\n By setting ``plot`` to `True`, plots of samples during Monte-Carlo\n iterations and the convergence of their mean are generated.\n\n .. code-block:: python\n\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n >>> traceinv(A, method='hutchinson', assume_matrix='sym_pos',\n ... solver_tol=1e-4, min_num_samples=50, max_num_samples=150,\n ... error_rtol=2e-4, confidence_level=0.95,\n ... outlier_significance_level=0.001, plot=True)\n\n .. image:: ../_static/images/plots/traceinv_hutchinson_convergence.png\n :align: center\n :class: custom-dark\n\n In the left plot, the samples are shown in circles and the cumulative mean\n of the samples is shown by a solid black curve. The shaded area corresponds\n to the 95% confidence interval :math:`\\pm 1.96 \\sigma`, which is set by\n ``confidence_level=0.95``. The samples outside the interval of 99.9% are\n considered outliers, which is set by the significance level\n ``outlier_significance_level=0.001``.\n\n In the right plot, the darker shaded area in the interval :math:`[0, 50]`\n shows the minimum number of samples and is set by ``min_num_samples=50``.\n The iterations do not stop till the minimum number of iterations is passed.\n We can observe that sampling is terminated after 140 iterations where the\n relat""ive error of samples reaches 0.02% since we set ``error_rtol=2e-4``.\n The lighter shaded area in the interval :math:`[140, 150]` corresponds to\n the iterations that were not performed to reach the specified maximum\n iterations by ``max_num_samples=150``.\n ";
2656 static const char __pyx_k_linear_algebra_matrix_utilities[] = "_linear_algebra.matrix_utilities";
2657 static const char __pyx_k_trace_estimator_trace_estimator[] = "_trace_estimator.trace_estimator_plot_utilities";
2658 static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
2659 static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
2660 static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
2661 static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
2662 static const char __pyx_k_Data_type_should_be_either_float[] = "Data type should be either \"float32\" or \"float64\"";
2663 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
2664 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
2665 static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
2666 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
2667 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
2668 static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
2669 static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
2670 static const char __pyx_k_imate_traceinv__hutchinson_metho[] = "imate/traceinv/_hutchinson_method.pyx";
2671 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2672 static const char __pyx_k_num_gpu_threads_per_multiprocess[] = "num_gpu_threads_per_multiprocessor";
2673 static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
2674 static const char __pyx_k_imate_traceinv__hutchinson_metho_2[] = "imate.traceinv._hutchinson_method";
2675 static PyObject *__pyx_n_s_A;
2676 static PyObject *__pyx_n_s_ASCII;
2677 static PyObject *__pyx_n_s_AinvpE;
2678 static PyObject *__pyx_n_s_AtA;
2679 static PyObject *__pyx_kp_u_AtA_cannot_be_None;
2680 static PyObject *__pyx_n_s_B;
2681 static PyObject *__pyx_n_s_BE;
2682 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2683 static PyObject *__pyx_n_s_C;
2684 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2685 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2686 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2687 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2688 static PyObject *__pyx_kp_u_Data_type_should_be_either_float;
2689 static PyObject *__pyx_n_s_E;
2690 static PyObject *__pyx_n_s_Ellipsis;
2691 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2692 static PyObject *__pyx_n_u_F;
2693 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
2694 static PyObject *__pyx_n_s_IndexError;
2695 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2696 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2697 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2698 static PyObject *__pyx_n_s_MemoryError;
2699 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2700 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2701 static PyObject *__pyx_n_b_O;
2702 static PyObject *__pyx_n_s_OpE;
2703 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2704 static PyObject *__pyx_n_s_PickleError;
2705 static PyObject *__pyx_n_s_RuntimeError;
2706 static PyObject *__pyx_n_s_T;
2707 static PyObject *__pyx_kp_u_Trace_of_matrix_or_linear_opera;
2708 static PyObject *__pyx_n_s_TypeError;
2709 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2710 static PyObject *__pyx_n_s_ValueError;
2711 static PyObject *__pyx_n_s_View_MemoryView;
2712 static PyObject *__pyx_n_s_abs;
2713 static PyObject *__pyx_n_u_absolute_error;
2714 static PyObject *__pyx_n_s_alg_wall_time;
2715 static PyObject *__pyx_n_u_alg_wall_time;
2716 static PyObject *__pyx_n_s_allocate_buffer;
2717 static PyObject *__pyx_n_s_assume_matrix;
2718 static PyObject *__pyx_n_u_assume_matrix;
2719 static PyObject *__pyx_n_s_average_estimates;
2720 static PyObject *__pyx_n_s_base;
2721 static PyObject *__pyx_n_s_c;
2722 static PyObject *__pyx_n_u_c;
2723 static PyObject *__pyx_n_s_cE;
2724 static PyObject *__pyx_n_s_check_arguments;
2725 static PyObject *__pyx_n_s_check_convergence;
2726 static PyObject *__pyx_n_s_class;
2727 static PyObject *__pyx_n_s_cline_in_traceback;
2728 static PyObject *__pyx_n_s_confidence_level;
2729 static PyObject *__pyx_n_u_confidence_level;
2730 static PyObject *__pyx_kp_s_contiguous_and_direct;
2731 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2732 static PyObject *__pyx_n_s_converged;
2733 static PyObject *__pyx_n_u_converged;
2734 static PyObject *__pyx_n_u_convergence;
2735 static PyObject *__pyx_n_s_convergence_tools;
2736 static PyObject *__pyx_n_s_cpu_count;
2737 static PyObject *__pyx_n_s_cpu_proc_time;
2738 static PyObject *__pyx_n_u_cpu_proc_time;
2739 static PyObject *__pyx_n_u_data_type;
2740 static PyObject *__pyx_n_s_data_type_name;
2741 static PyObject *__pyx_n_u_density;
2742 static PyObject *__pyx_n_u_device;
2743 static PyObject *__pyx_n_s_dict;
2744 static PyObject *__pyx_n_s_dtype;
2745 static PyObject *__pyx_n_s_dtype_is_object;
2746 static PyObject *__pyx_n_s_empty;
2747 static PyObject *__pyx_n_s_encode;
2748 static PyObject *__pyx_n_s_enumerate;
2749 static PyObject *__pyx_n_s_eps;
2750 static PyObject *__pyx_n_s_error;
2751 static PyObject *__pyx_n_u_error;
2752 static PyObject *__pyx_n_s_error_atol;
2753 static PyObject *__pyx_n_u_error_atol;
2754 static PyObject *__pyx_n_s_error_rtol;
2755 static PyObject *__pyx_n_u_error_rtol;
2756 static PyObject *__pyx_n_u_exponent;
2757 static PyObject *__pyx_n_s_finfo;
2758 static PyObject *__pyx_n_s_flags;
2759 static PyObject *__pyx_n_b_float32;
2760 static PyObject *__pyx_n_s_float32;
2761 static PyObject *__pyx_n_b_float64;
2762 static PyObject *__pyx_n_s_float64;
2763 static PyObject *__pyx_n_s_format;
2764 static PyObject *__pyx_n_s_fortran;
2765 static PyObject *__pyx_n_u_fortran;
2766 static PyObject *__pyx_n_u_gen;
2767 static PyObject *__pyx_n_s_get_data_type_name;
2768 static PyObject *__pyx_n_s_get_density;
2769 static PyObject *__pyx_n_s_get_nnz;
2770 static PyObject *__pyx_n_s_getstate;
2771 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2772 static PyObject *__pyx_n_s_gram;
2773 static PyObject *__pyx_n_u_gram;
2774 static PyObject *__pyx_n_u_hutchinson;
2775 static PyObject *__pyx_n_s_hutchinson_method;
2776 static PyObject *__pyx_n_s_hutchinson_method_double;
2777 static PyObject *__pyx_n_s_hutchinson_method_float;
2778 static PyObject *__pyx_kp_u_hutchinson_method_line_37;
2779 static PyObject *__pyx_n_s_hutchinson_method_utilities;
2780 static PyObject *__pyx_n_s_i;
2781 static PyObject *__pyx_n_s_id;
2782 static PyObject *__pyx_kp_s_imate_traceinv__hutchinson_metho;
2783 static PyObject *__pyx_n_s_imate_traceinv__hutchinson_metho_2;
2784 static PyObject *__pyx_n_s_imatmul;
2785 static PyObject *__pyx_n_s_import;
2786 static PyObject *__pyx_n_s_info;
2787 static PyObject *__pyx_n_s_init_alg_wall_time;
2788 static PyObject *__pyx_n_s_init_cpu_proc_time;
2789 static PyObject *__pyx_n_s_init_tot_wall_time;
2790 static PyObject *__pyx_n_s_isspmatrix;
2791 static PyObject *__pyx_n_s_itemsize;
2792 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2793 static PyObject *__pyx_n_s_linear_algebra;
2794 static PyObject *__pyx_n_s_linear_algebra_matrix_utilities;
2795 static PyObject *__pyx_n_s_linear_solver;
2796 static PyObject *__pyx_n_s_main;
2797 static PyObject *__pyx_n_s_matmul;
2798 static PyObject *__pyx_n_u_matrix;
2799 static PyObject *__pyx_n_s_max_num_samples;
2800 static PyObject *__pyx_n_u_max_num_samples;
2801 static PyObject *__pyx_n_s_memoryview_E;
2802 static PyObject *__pyx_n_s_memview;
2803 static PyObject *__pyx_n_u_method;
2804 static PyObject *__pyx_n_s_min_num_samples;
2805 static PyObject *__pyx_n_u_min_num_samples;
2806 static PyObject *__pyx_n_s_mode;
2807 static PyObject *__pyx_n_s_multiprocessing;
2808 static PyObject *__pyx_n_s_name;
2809 static PyObject *__pyx_n_s_name_2;
2810 static PyObject *__pyx_n_s_nan;
2811 static PyObject *__pyx_n_s_ndim;
2812 static PyObject *__pyx_n_s_new;
2813 static PyObject *__pyx_n_u_nnz;
2814 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2815 static PyObject *__pyx_n_u_num_cpu_threads;
2816 static PyObject *__pyx_n_u_num_gpu_devices;
2817 static PyObject *__pyx_n_u_num_gpu_multiprocessors;
2818 static PyObject *__pyx_n_u_num_gpu_threads_per_multiprocess;
2819 static PyObject *__pyx_n_u_num_inquiries;
2820 static PyObject *__pyx_n_s_num_outliers;
2821 static PyObject *__pyx_n_u_num_outliers;
2822 static PyObject *__pyx_n_s_num_processed_samples;
2823 static PyObject *__pyx_n_s_num_samples_used;
2824 static PyObject *__pyx_n_u_num_samples_used;
2825 static PyObject *__pyx_n_s_num_threads;
2826 static PyObject *__pyx_n_s_numpy;
2827 static PyObject *__pyx_n_s_obj;
2828 static PyObject *__pyx_n_s_operator_dot;
2829 static PyObject *__pyx_n_s_order;
2830 static PyObject *__pyx_n_s_orthogonalize;
2831 static PyObject *__pyx_n_u_orthogonalize;
2832 static PyObject *__pyx_n_s_outlier_significance_level;
2833 static PyObject *__pyx_n_u_outlier_significance_level;
2834 static PyObject *__pyx_n_s_p;
2835 static PyObject *__pyx_n_s_pack;
2836 static PyObject *__pyx_n_s_perf_counter;
2837 static PyObject *__pyx_n_s_pickle;
2838 static PyObject *__pyx_n_s_plot;
2839 static PyObject *__pyx_n_s_plot_convergence;
2840 static PyObject *__pyx_n_s_print_summary;
2841 static PyObject *__pyx_n_s_process_time;
2842 static PyObject *__pyx_n_s_processed_samples_indices;
2843 static PyObject *__pyx_n_s_pyx_PickleError;
2844 static PyObject *__pyx_n_s_pyx_checksum;
2845 static PyObject *__pyx_n_s_pyx_getbuffer;
2846 static PyObject *__pyx_n_s_pyx_result;
2847 static PyObject *__pyx_n_s_pyx_state;
2848 static PyObject *__pyx_n_s_pyx_type;
2849 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2850 static PyObject *__pyx_n_s_pyx_vtable;
2851 static PyObject *__pyx_n_s_range;
2852 static PyObject *__pyx_n_s_reduce;
2853 static PyObject *__pyx_n_s_reduce_cython;
2854 static PyObject *__pyx_n_s_reduce_ex;
2855 static PyObject *__pyx_n_u_relative_error;
2856 static PyObject *__pyx_n_s_return_info;
2857 static PyObject *__pyx_n_s_rmatmul;
2858 static PyObject *__pyx_n_s_samples;
2859 static PyObject *__pyx_n_u_samples;
2860 static PyObject *__pyx_n_u_samples_mean;
2861 static PyObject *__pyx_n_u_samples_processed_order;
2862 static PyObject *__pyx_n_s_scipy;
2863 static PyObject *__pyx_n_s_scipy_sparse;
2864 static PyObject *__pyx_n_s_seed;
2865 static PyObject *__pyx_n_u_seed;
2866 static PyObject *__pyx_n_s_setstate;
2867 static PyObject *__pyx_n_s_setstate_cython;
2868 static PyObject *__pyx_n_s_shape;
2869 static PyObject *__pyx_n_s_size;
2870 static PyObject *__pyx_n_u_size;
2871 static PyObject *__pyx_n_u_solver;
2872 static PyObject *__pyx_n_s_solver_tol;
2873 static PyObject *__pyx_n_u_solver_tol;
2874 static PyObject *__pyx_n_u_sparse;
2875 static PyObject *__pyx_n_s_square;
2876 static PyObject *__pyx_n_s_start;
2877 static PyObject *__pyx_n_s_step;
2878 static PyObject *__pyx_n_s_stop;
2879 static PyObject *__pyx_kp_s_strided_and_direct;
2880 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2881 static PyObject *__pyx_kp_s_strided_and_indirect;
2882 static PyObject *__pyx_kp_s_stringsource;
2883 static PyObject *__pyx_n_s_struct;
2884 static PyObject *__pyx_n_s_test;
2885 static PyObject *__pyx_n_s_time;
2886 static PyObject *__pyx_n_u_time;
2887 static PyObject *__pyx_n_s_tot_wall_time;
2888 static PyObject *__pyx_n_u_tot_wall_time;
2889 static PyObject *__pyx_n_s_trace;
2890 static PyObject *__pyx_n_s_trace_estimator_trace_estimator;
2891 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2892 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2893 static PyObject *__pyx_n_s_unpack;
2894 static PyObject *__pyx_n_s_update;
2895 static PyObject *__pyx_n_s_vector_size;
2896 static PyObject *__pyx_n_s_verbose;
2897 static PyObject *__pyx_n_u_version;
2898 static PyObject *__pyx_n_s_version_2;
2899 static PyObject *__pyx_n_s_zeros;
2900 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_return_info, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_verbose, PyObject *__pyx_v_plot); /* proto */
2901 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads); /* proto */
2902 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads); /* proto */
2903 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_p, PyObject *__pyx_v_gram, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_B, PyObject *__pyx_v_E); /* proto */
2904 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer); /* proto */
2905 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2906 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2907 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2908 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
2909 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
2910 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
2911 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /* proto */
2912 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
2913 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2914 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2915 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2916 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
2917 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
2918 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object); /* proto */
2919 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2920 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
2921 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto */
2922 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
2923 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2924 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2925 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2926 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2927 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2928 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2929 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2930 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2931 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2932 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2933 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2934 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2935 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2936 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2937 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2938 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2939 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
2940 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2941 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2942 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2943 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
2944 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2945 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */
2946 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2947 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2948 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2949 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2950 static PyObject *__pyx_float_0_95;
2951 static PyObject *__pyx_float_1eneg_2;
2952 static PyObject *__pyx_float_1eneg_6;
2953 static PyObject *__pyx_float_0_001;
2954 static PyObject *__pyx_int_0;
2955 static PyObject *__pyx_int_1;
2956 static PyObject *__pyx_int_10;
2957 static PyObject *__pyx_int_50;
2958 static PyObject *__pyx_int_112105877;
2959 static PyObject *__pyx_int_136983863;
2960 static PyObject *__pyx_int_184977713;
2961 static PyObject *__pyx_int_neg_1;
2962 static PyObject *__pyx_codeobj_;
2963 static PyObject *__pyx_slice__4;
2964 static PyObject *__pyx_tuple__2;
2965 static PyObject *__pyx_tuple__6;
2966 static PyObject *__pyx_tuple__8;
2967 static PyObject *__pyx_tuple__9;
2968 static PyObject *__pyx_tuple__10;
2969 static PyObject *__pyx_tuple__11;
2970 static PyObject *__pyx_tuple__12;
2971 static PyObject *__pyx_tuple__13;
2972 static PyObject *__pyx_tuple__14;
2973 static PyObject *__pyx_tuple__15;
2974 static PyObject *__pyx_tuple__16;
2975 static PyObject *__pyx_tuple__17;
2976 static PyObject *__pyx_tuple__18;
2977 static PyObject *__pyx_tuple__19;
2978 static PyObject *__pyx_tuple__20;
2979 static PyObject *__pyx_tuple__21;
2980 static PyObject *__pyx_tuple__22;
2981 static PyObject *__pyx_tuple__23;
2982 static PyObject *__pyx_tuple__24;
2983 static PyObject *__pyx_tuple__26;
2984 static PyObject *__pyx_tuple__27;
2985 static PyObject *__pyx_tuple__28;
2986 static PyObject *__pyx_tuple__29;
2987 static PyObject *__pyx_tuple__30;
2988 static PyObject *__pyx_tuple__31;
2989 static PyObject *__pyx_tuple__32;
2990 static PyObject *__pyx_tuple__33;
2991 static PyObject *__pyx_tuple__34;
2992 static PyObject *__pyx_tuple__35;
2993 static PyObject *__pyx_tuple__36;
2994 static PyObject *__pyx_tuple__37;
2995 static PyObject *__pyx_codeobj__3;
2996 static PyObject *__pyx_codeobj__5;
2997 static PyObject *__pyx_codeobj__7;
2998 static PyObject *__pyx_codeobj__25;
2999 /* Late includes */
3000 
3001 /* "imate/traceinv/_hutchinson_method.pyx":37
3002  * # =================
3003  *
3004  * def hutchinson_method( # <<<<<<<<<<<<<<
3005  * A,
3006  * gram=False,
3007  */
3008 
3009 /* Python wrapper */
3010 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3011 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_hutchinson_method[] = "hutchinson_method(A, gram=False, p=1, return_info=False, B=None, C=None, assume_matrix=u'gen', min_num_samples=10, max_num_samples=50, error_atol=None, error_rtol=1e-2, confidence_level=0.95, outlier_significance_level=0.001, solver_tol=1e-6, orthogonalize=True, seed=None, num_threads=0, verbose=False, plot=False)\n\n Trace of matrix or linear operator using stochastic Lanczos quadrature\n method.\n\n If `C` is `None`, given the matrices :math:`\\mathbf{A}` and\n :math:`\\mathbf{B}` and the integer exponent :math:`p`, the following is\n computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\right).\n\n If `B` is `None`, it is assumed that :math:`\\mathbf{B}` is the identity\n matrix.\n\n If `C` is not `None`, given the matrix :math:`\\mathbf{C}`, the following\n is instead computed:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B} \\mathbf{A}^{-p} \\mathbf{C}\n \\mathbf{A}^{-p} \\right).\n\n If ``gram`` is `True`, then :math:`\\mathbf{A}` in the above is replaced by\n the Gramian matrix :math:`\\mathbf{A}^{\\intercal} \\mathbf{A}`. Namely, if\n `C` is `None`:\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right),\n\n and if `C` is not `None`,\n\n .. math::\n\n \\mathrm{trace} \\left(\\mathbf{B}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\mathbf{C}\n (\\mathbf{A}^{\\intercal}\\mathbf{A})^{-p} \\right).\n\n Parameters\n ----------\n\n A : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. If ``gram`` is `True`, the matrix can be\n non-square.\n\n .. note::\n\n In the Hutchinson method, the matrix cannot be a type of\n :class:`Matrix` or :class:`imate.AffineMatrixFunction` classes.\n\n gram : bool, default=False\n If `True`, the trace of the Gramian matrix,\n :math:`(\\mathbf{A}^{\\intercal}\\mathbf{A})^p`"", is computed. The\n Gramian matrix itself is not directly computed. If `False`, the\n trace of :math:`\\mathbf{A}^p` is computed.\n\n p : float, default=1.0\n The integer exponent :math:`p` in :math:`\\mathbf{A}^{-p}`.\n\n return_info : bool, default=False\n If `True`, this function also returns a dictionary containing\n information about the inner computation, such as process time,\n algorithm settings, etc.\n\n B : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `B` should be the same size and type of `A`.\n if `B` is `None`, it is assumed that `B` is the identity matrix.\n\n C : numpy.ndarray, scipy.sparse\n A sparse or dense matrix. `C` should be the same size and type of `A`.\n\n assume_matrix : str {'gen', 'sym', 'pos', 'sym_pos'}, default: 'gen'\n Type of matrix `A`:\n\n * ``gen`` assumes `A` is a generic matrix.\n * ``sym`` assumes `A` is symmetric.\n * ``pos`` assumes `A` is positive-definite.\n * ``sym_pos`` assumes `A` is symmetric and positive-definite.\n\n min_num_samples : int, default=10\n The minimum number of Monte-Carlo samples. If the convergence criterion\n is reached before finishing the minimum number of iterations, the\n iterations are forced to continue till the minimum number of iterations\n is finished. This value should be smaller than\n ``maximum_num_samples``.\n\n max_num_samples : int, default=50\n The maximum number of Monte-Carlo samples. If the convergence criterion\n is not reached by the maximum number of iterations, the iterations are\n forced to stop. This value should be larger than\n ``minimum_num_samples``.\n\n error_atol : float, default=None\n Tolerance of the absolute error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If"" the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n error_rtol : float, default=None\n Tolerance of the relative error of convergence of the output. Once the\n error of convergence reaches ``error_atol + error_rtol * output``, the\n iteration is terminated. If the convergence criterion is not met by the\n tolerance, then the iterations continue till reaching\n ``max_num_samples`` iterations. If `None`, the termination criterion\n does not depend on this parameter.\n\n confidence_level : float, default=0.95\n Confidence level of error, which is a number between `0` and `1`. The\n error of convergence of the population of samples is defined by their\n standard deviation times the Z-score, which depends on the confidence\n level. See notes below for details.\n\n outlier_significance_level : float, default=0.001\n One minus the confidence level of the uncertainty of the outliers of\n the output samples. This is a number between `0` and `1`.\n\n solver_tol : float, default=1e-6\n Tolerance of solving linear system.\n\n orthogonalize : int, default=0\n If `True`, it orthogonalizes the set of random vectors used for\n Monte-Carlo sampling. This might lead to a better estimation of the\n output.\n\n seed : int, default=None\n A non-negative integer to be used as seed to initiate the generation of\n sequences of peudo-random numbers in the algorithm. This is useful to\n make the result of the randomized algorithm to be reproducible. If\n ``None`` or a negative integer is given, the given seed value is\n ignored and the current processor time is used as the seed to initiate\n he generation random number sequences. In this case,"" the result is not\n reproducible, rather, is pseudo-random.\n\n num_threads : int, default=0\n Number of processor threads to employ for parallel computation on CPU.\n If set to `0` or a number larger than the available number of threads,\n all threads of the processor are used. The parallelization is performed\n over the Monte-Carlo iterations.\n\n verbose : bool, default=False\n Prints extra information about the computations.\n\n plot : bool, default=False\n Plots convergence of samples. To this end, `matplotlib` package should\n be installed. If no display is available (such as running this code on\n remote machines), the plots are saved as an `SVG` file in the current\n directory.\n\n Returns\n -------\n\n traceinv : float or numpy.array\n Trace of inverse of matrix.\n\n info : dict\n (Only if ``return_info`` is `True`) A dictionary of information with\n the following.\n\n * ``matrix``:\n * ``data_type``: `str`, {`float32`, `float64`, `float128`}. Type of\n the matrix data.\n * ``gram``: `bool`, whether the matrix `A` or its Gramian is\n considered.\n * ``exponent``: `float`, the exponent `p` in :math:`\\mathbf{A}^p`.\n * ``assume_matrix``: `str`, {`gen`, `sym`, `pos`, `sym_pos`},\n determines the type of matrix `A`.\n * ``size``: (int, int) The size of matrix `A`.\n * ``sparse``: `bool`, whether the matrix `A` is sparse or dense.\n * ``nnz``: `int`, if `A` is sparse, the number of non-zero elements\n of `A`.\n * ``density``: `float`, if `A` is sparse, the density of `A`, which\n is the `nnz` divided by size squared.\n * ``num_inquiries``: `int`, the size of inquiries of each parameter\n of the linear operator `A`. If `A` is a matrix, this is always\n `1`. ""If `A` is a type of :class:`AffineMatrixFunction`, this\n value is the number of :math:`t_i` parameters.\n\n * ``convergence``:\n * ``converged``: `bool`, whether the Monte-Carlo sampling\n converged.\n * ``min_num_samples``: `int`, the minimum number of Monte-Carlo\n iterations.\n * ``max_num_samples``: `int`, the maximum number of Monte-Carlo\n iterations.\n * ``num_outliers``: `int`, number of outliers found during search\n for outliers among the array of output.\n * ``num_samples_used``: `int`, number of Monte-Carlo samples used\n to produce the output. This is the total number of iterations\n minus the number of outliers.\n * ``samples``: `array` [`float`], an array of the size\n `max_num_samples`. The first few entries (`num_samples_used`) of\n this array are the output results of the Monte-Carlo sampling.\n The average of these samples is the final result. The rest of\n this array is `nan`.\n * ``samples_mean``: `float`, mean of the `samples` array, excluding\n the `nan` values.\n * ``samples_processed_order``: `array` [`int`], in parallel\n processing, samples are processed in non-sequential order. This\n array, which has the same size as `samples`, keeps track of the\n order in which each sample is processed.\n\n * ``error``:\n * ``absolute_error``: `float`, the absolute error of the\n convergence of samples.\n * ``confidence_level``: `float`, the confidence level used to\n calculate the error from standard deviation of samples.\n * ``error_atol``: `float`, the tolerance of absolute error of the\n convergence of samples.\n * ``error_rtol``: `float`, the tolerance of relative error of ""the\n convergence of samples.\n * ``outlier_significance_level``: `float`, the significance level\n used to determine the outliers in samples.\n * ``relative_error``: `float`, the relative error of the\n convergence of samples.\n\n * ``device``:\n * ``num_cpu_threads``: `int`, number of CPU threads used in shared\n memory parallel processing.\n * ``num_gpu_devices``: `int`, number of GPU devices used in the\n multi-GPU (GPU farm) computation.\n * ``num_gpu_multiprocessors``: `int`, number of GPU\n multi-processors.\n * ``num_gpu_threads_per_multiprocessor``: `int`, number of GPU\n threads on each GPU multi-processor.\n\n * ``time``:\n * ``tot_wall_time``: `float`, total elapsed time of computation.\n * ``alg_wall_time``: `float`, elapsed time of computation during\n only the algorithm execution.\n * ``cpu_proc_time``: `float`, the CPU processing time of\n computation.\n\n * ``solver``:\n * ``version``: `str`, version of imate.\n * ``method``: 'hutchinson'.\n * ``solver_tol``: `float`, tolerance of solving linear system.\n * ``orthogonalize``: `bool`, orthogonalization flag.\n * ``seed`` : `int`, seed value for random number generation.\n\n Raises\n ------\n\n ImportError\n If the package has not been compiled with GPU support, but ``gpu`` is\n set to `True`. To resolve the issue, set ``gpu`` to `False` to be able\n to use the existing installation. Alternatively, export the\n environment variable ``USE_CUDA=1`` and recompile the source code of\n the package.\n\n See Also\n --------\n\n imate.logdet\n imate.trace\n imate.schatten\n\n Notes\n -----\n\n **Computational Complexity:**\n\n This method uses the Hutc""hinson, which is a randomized algorithm. The\n computational complexity of this method is\n\n .. math::\n\n \\mathcal{O}((\\rho n^2s),\n\n where :math:`n` is the matrix size, :math:`\\rho` is the density of\n sparse matrix (for dense matrix, :math:`\\rho=1`), and :math:`s` is the\n number of samples (set with ``min_num_samples`` and ``max_num_samples``).\n\n This method can be used on very large matrices (:math:`n > 2^{12}`). The\n solution is an approximation.\n\n **Convergence criterion:**\n\n Let :math:`n_{\\min}` and :math:`n_{\\max}` be the minimum and maximum\n number of iterations respectively defined by ``min_num_samples`` and\n ``max_num_samples``. The iterations terminate at\n :math:`n_{\\min} \\leq i \\leq n_{\\max}` where :math:`i` is the\n iteration counter. The iterations stop earlier at :math:`i < n_{\\max}` if\n the convergence error of the mean of the samples is satisfied, as follows.\n\n Suppose :math:`s(j)` and :math:`\\sigma(i)` are respectively the mean and\n standard deviation of samples after :math:`j` iterations. The error of\n convergence, :math:`e(j)`, is defined by\n\n .. math::\n\n e(j) = \\frac{\\sigma(j)}{\\sqrt{j}} Z\n\n where :math:`Z` is the Z-score defined by\n\n .. math::\n\n Z = \\sqrt{2} \\mathrm{erf}^{-1}(\\phi).\n\n In the above, :math:`\\phi` is the confidence level and set by\n ``confidence_level`` argument, and :math:`\\mathrm{erf}^{-1}` is the\n inverse error function. A confidence level of 95%, for instance, means that\n the Z-score is 1.96, which means the confidence interval is\n :math:`\\pm 1.96 \\sigma`.\n\n The termination criterion is\n\n .. math::\n\n e(j) < \\epsilon_a + s(j) \\epsilon_r,\n\n where :math:`\\epsilon_{a}` and :math:`\\epsilon_r` are the absolute and\n relative error tolerances respectively, and they are set by ``error_atol``\n and ``error_rtol``.\n\n **Plotting:**\n\n If ``plot`""` is set to `True`, it plots the convergence of samples and their\n relative error.\n\n * If no graphical backend exists (such as running the code on a remote\n server or manually disabling the X11 backend), the plot will not be\n shown, rather, it will be saved as an ``svg`` file in the current\n directory.\n * If the executable ``latex`` is available on ``PATH``, the plot is\n rendered using :math:`\\rm\\LaTeX` and it may take slightly longer to\n produce the plot.\n * If :math:`\\rm\\LaTeX` is not installed, it uses any available San-Serif\n font to render the plot.\n\n To manually disable interactive plot display and save the plot as\n ``svg`` instead, add the following at the very beginning of your code\n before importing :mod:`imate`:\n\n .. code-block:: python\n\n >>> import os\n >>> os.environ['IMATE_NO_DISPLAY'] = 'True'\n\n References\n ----------\n\n * `Ubaru, S., Chen, J., and Saad, Y. (2017)\n <https://www-users.cs.umn.edu/~saad/PDF/ys-2016-04.pdf>`_,\n Fast Estimation of :math:`\\mathrm{tr}(F(A))` Via Stochastic Lanczos\n Quadrature, SIAM J. Matrix Anal. Appl., 38(4), 1075-1099.\n\n Examples\n --------\n\n **Basic Usage:**\n\n Compute the trace of :math:`\\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Import packages\n >>> from imate import toeplitz, traceinv\n\n >>> # Generate a sample matrix\n >>> A = toeplitz(2, 1, size=100)\n\n >>> # Compute trace of inverse\n >>> traceinv(A, p=2, method='hutchinson')\n 24.73726368966402\n\n Compute the trace of :math:`(\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson')\n 17.751659383784748\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another"" sample matrix\n >>> B = toeplitz(4, 3, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B)\n 99.8817360381704\n\n Compute the trace of :math:`\\mathbf{B} \\mathbf{A}^{-2} \\mathbf{C}\n \\mathbf{A}^{-2}`:\n\n .. code-block:: python\n\n >>> # Generate another sample matrix\n >>> C = toeplitz(5, 4, size=100)\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, p=2, method='hutchinson', B=B, C=C)\n 124.45436379980006\n\n Compute the trace of :math:`\\mathbf{B} (\\mathbf{A}^{\\intercal}\n \\mathbf{A})^{-2} \\mathbf{C} (\\mathbf{A}^{\\intercal} \\mathbf{A})^{-2}`:\n\n .. code-block:: python\n\n >>> # Using Gramian matrix of A\n >>> traceinv(A, gram=True, p=2, method='hutchinson', B=B, C=C)\n 5.517453125230929\n\n **Verbose output:**\n\n By setting ``verbose`` to `True`, useful info about the process is\n printed.\n\n .. literalinclude:: ../_static/data/imate.traceinv.hutchinson-verbose.txt\n :language: python\n\n **Output information:**\n\n Print information about the inner computation:\n\n .. code-block:: python\n\n >>> ti, info = traceinv(A, method='hutchinson', return_info=True)\n >>> print(ti)\n 50.059307947603585\n\n >>> # Print dictionary neatly using pprint\n >>> from pprint import pprint\n >>> pprint(info)\n {\n 'matrix': {\n 'assume_matrix': 'gen',\n 'data_type': b'float64',\n 'density': 0.0199,\n 'exponent': 1,\n 'gram': False,\n 'nnz': 199,\n 'num_inquiries': 1,\n 'size': (100, 100),\n 'sparse': True\n },\n 'convergence': {\n 'converged': False,\n 'max_num_samples': 50,\n 'min_num_samples': 10,\n 'num_outliers': 0,""\n 'num_samples_used': 50,\n 'samples': array([52.237154, ..., 51.37932704]),\n 'samples_mean': 50.059307947603585,\n 'samples_processed_order': array([ 0, ..., 49])\n },\n 'error': {\n 'absolute_error': 0.8111131801161796,\n 'confidence_level': 0.95,\n 'error_atol': 0.0,\n 'error_rtol': 0.01,\n 'outlier_significance_level': 0.001,\n 'relative_error': 0.016203044216375525\n },\n 'solver': {\n 'method': 'hutchinson',\n 'orthogonalize': True,\n 'seed': None,\n 'solver_tol': 1e-06,\n 'version': '0.16.0'\n },\n 'device': {\n 'num_cpu_threads': 8,\n 'num_gpu_devices': 0,\n 'num_gpu_multiprocessors': 0,\n 'num_gpu_threads_per_multiprocessor': 0\n },\n 'time': {\n 'alg_wall_time': 0.03236744087189436,\n 'cpu_proc_time': 0.047695197999999994,\n 'tot_wall_time': 0.033352302853018045\n }\n }\n\n **Large matrix:**\n\n Compute the trace of :math:`\\mathbf{A}^{-1}` for a very large sparse\n matrix using at least `100` samples.\n\n .. code-block:: python\n :emphasize-lines: 5, 6, 7\n\n >>> # Create a symmetric positive-definite matrix of size one million.\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n\n >>> # Approximate trace using hutchinson method\n >>> ti, info = traceinv(A, method='hutchinson', solver_tol=1e-4,\n ... assume_matrix='sym_pos', min_num_samples=100,\n ... max_num_samples=200, return_info=True)\n >>> print(ti)\n 333292.3226031165\n\n >>> # Find the time it took to compute the above\n >>> print(info['time'])""\n {\n 'tot_wall_time': 175.93423152901232,\n 'alg_wall_time': 119.86316476506181,\n 'cpu_proc_time': 572.180877451\n }\n\n Compare the result of the above approximation with the exact solution of\n the trace using the analytic relation for Toeplitz matrix. See\n :func:`imate.sample_matrices.toeplitz_traceinv` for details.\n\n .. code-block:: python\n\n >>> from imate.sample_matrices import toeplitz_traceinv\n >>> toeplitz_traceinv(2, 1, size=1000000, gram=True)\n 333333.2222222222\n\n It can be seen that the error of approximation is :math:`0.012 \\%`. This\n accuracy is remarkable considering that the computation on such a large\n matrix took on 119 seconds. Computing the trace of such a large matrix\n using any of the exact methods (such as ``exact`` or ``eigenvalue``) is\n infeasible.\n\n **Plotting:**\n\n By setting ``plot`` to `True`, plots of samples during Monte-Carlo\n iterations and the convergence of their mean are generated.\n\n .. code-block:: python\n\n >>> A = toeplitz(2, 1, size=1000000, gram=True)\n >>> traceinv(A, method='hutchinson', assume_matrix='sym_pos',\n ... solver_tol=1e-4, min_num_samples=50, max_num_samples=150,\n ... error_rtol=2e-4, confidence_level=0.95,\n ... outlier_significance_level=0.001, plot=True)\n\n .. image:: ../_static/images/plots/traceinv_hutchinson_convergence.png\n :align: center\n :class: custom-dark\n\n In the left plot, the samples are shown in circles and the cumulative mean\n of the samples is shown by a solid black curve. The shaded area corresponds\n to the 95% confidence interval :math:`\\pm 1.96 \\sigma`, which is set by\n ``confidence_level=0.95``. The samples outside the interval of 99.9% are\n considered outliers, which is set by the significance level\n ``outlier_significance_level=0.001``.\n\n In the rig""ht plot, the darker shaded area in the interval :math:`[0, 50]`\n shows the minimum number of samples and is set by ``min_num_samples=50``.\n The iterations do not stop till the minimum number of iterations is passed.\n We can observe that sampling is terminated after 140 iterations where the\n relative error of samples reaches 0.02% since we set ``error_rtol=2e-4``.\n The lighter shaded area in the interval :math:`[140, 150]` corresponds to\n the iterations that were not performed to reach the specified maximum\n iterations by ``max_num_samples=150``.\n ";
3012 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_1hutchinson_method = {"hutchinson_method", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_hutchinson_method};
3013 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_1hutchinson_method(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3014  PyObject *__pyx_v_A = 0;
3015  PyObject *__pyx_v_gram = 0;
3016  PyObject *__pyx_v_p = 0;
3017  PyObject *__pyx_v_return_info = 0;
3018  PyObject *__pyx_v_B = 0;
3019  PyObject *__pyx_v_C = 0;
3020  PyObject *__pyx_v_assume_matrix = 0;
3021  PyObject *__pyx_v_min_num_samples = 0;
3022  PyObject *__pyx_v_max_num_samples = 0;
3023  PyObject *__pyx_v_error_atol = 0;
3024  PyObject *__pyx_v_error_rtol = 0;
3025  PyObject *__pyx_v_confidence_level = 0;
3026  PyObject *__pyx_v_outlier_significance_level = 0;
3027  PyObject *__pyx_v_solver_tol = 0;
3028  PyObject *__pyx_v_orthogonalize = 0;
3029  PyObject *__pyx_v_seed = 0;
3030  PyObject *__pyx_v_num_threads = 0;
3031  PyObject *__pyx_v_verbose = 0;
3032  PyObject *__pyx_v_plot = 0;
3033  int __pyx_lineno = 0;
3034  const char *__pyx_filename = NULL;
3035  int __pyx_clineno = 0;
3036  PyObject *__pyx_r = 0;
3037  __Pyx_RefNannyDeclarations
3038  __Pyx_RefNannySetupContext("hutchinson_method (wrapper)", 0);
3039  {
3040  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_return_info,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,&__pyx_n_s_verbose,&__pyx_n_s_plot,0};
3041  PyObject* values[19] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
3042 
3043  /* "imate/traceinv/_hutchinson_method.pyx":39
3044  * def hutchinson_method(
3045  * A,
3046  * gram=False, # <<<<<<<<<<<<<<
3047  * p=1,
3048  * return_info=False,
3049  */
3050  values[1] = ((PyObject *)((PyObject *)Py_False));
3051  values[2] = ((PyObject *)((PyObject *)__pyx_int_1));
3052 
3053  /* "imate/traceinv/_hutchinson_method.pyx":41
3054  * gram=False,
3055  * p=1,
3056  * return_info=False, # <<<<<<<<<<<<<<
3057  * B=None,
3058  * C=None,
3059  */
3060  values[3] = ((PyObject *)((PyObject *)Py_False));
3061 
3062  /* "imate/traceinv/_hutchinson_method.pyx":42
3063  * p=1,
3064  * return_info=False,
3065  * B=None, # <<<<<<<<<<<<<<
3066  * C=None,
3067  * assume_matrix='gen',
3068  */
3069  values[4] = ((PyObject *)((PyObject *)Py_None));
3070 
3071  /* "imate/traceinv/_hutchinson_method.pyx":43
3072  * return_info=False,
3073  * B=None,
3074  * C=None, # <<<<<<<<<<<<<<
3075  * assume_matrix='gen',
3076  * min_num_samples=10,
3077  */
3078  values[5] = ((PyObject *)((PyObject *)Py_None));
3079  values[6] = ((PyObject *)((PyObject*)__pyx_n_u_gen));
3080  values[7] = ((PyObject *)((PyObject *)__pyx_int_10));
3081  values[8] = ((PyObject *)((PyObject *)__pyx_int_50));
3082 
3083  /* "imate/traceinv/_hutchinson_method.pyx":47
3084  * min_num_samples=10,
3085  * max_num_samples=50,
3086  * error_atol=None, # <<<<<<<<<<<<<<
3087  * error_rtol=1e-2,
3088  * confidence_level=0.95,
3089  */
3090  values[9] = ((PyObject *)((PyObject *)Py_None));
3091  values[10] = ((PyObject *)((PyObject*)__pyx_float_1eneg_2));
3092  values[11] = ((PyObject *)((PyObject*)__pyx_float_0_95));
3093  values[12] = ((PyObject *)((PyObject*)__pyx_float_0_001));
3094  values[13] = ((PyObject *)((PyObject*)__pyx_float_1eneg_6));
3095 
3096  /* "imate/traceinv/_hutchinson_method.pyx":52
3097  * outlier_significance_level=0.001,
3098  * solver_tol=1e-6,
3099  * orthogonalize=True, # <<<<<<<<<<<<<<
3100  * seed=None,
3101  * num_threads=0,
3102  */
3103  values[14] = ((PyObject *)((PyObject *)Py_True));
3104 
3105  /* "imate/traceinv/_hutchinson_method.pyx":53
3106  * solver_tol=1e-6,
3107  * orthogonalize=True,
3108  * seed=None, # <<<<<<<<<<<<<<
3109  * num_threads=0,
3110  * verbose=False,
3111  */
3112  values[15] = ((PyObject *)((PyObject *)Py_None));
3113  values[16] = ((PyObject *)((PyObject *)__pyx_int_0));
3114 
3115  /* "imate/traceinv/_hutchinson_method.pyx":55
3116  * seed=None,
3117  * num_threads=0,
3118  * verbose=False, # <<<<<<<<<<<<<<
3119  * plot=False):
3120  * """
3121  */
3122  values[17] = ((PyObject *)((PyObject *)Py_False));
3123 
3124  /* "imate/traceinv/_hutchinson_method.pyx":56
3125  * num_threads=0,
3126  * verbose=False,
3127  * plot=False): # <<<<<<<<<<<<<<
3128  * """
3129  * Trace of matrix or linear operator using stochastic Lanczos quadrature
3130  */
3131  values[18] = ((PyObject *)((PyObject *)Py_False));
3132  if (unlikely(__pyx_kwds)) {
3133  Py_ssize_t kw_args;
3134  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3135  switch (pos_args) {
3136  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3137  CYTHON_FALLTHROUGH;
3138  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3139  CYTHON_FALLTHROUGH;
3140  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3141  CYTHON_FALLTHROUGH;
3142  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3143  CYTHON_FALLTHROUGH;
3144  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3145  CYTHON_FALLTHROUGH;
3146  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3147  CYTHON_FALLTHROUGH;
3148  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3149  CYTHON_FALLTHROUGH;
3150  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3151  CYTHON_FALLTHROUGH;
3152  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3153  CYTHON_FALLTHROUGH;
3154  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3155  CYTHON_FALLTHROUGH;
3156  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3157  CYTHON_FALLTHROUGH;
3158  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3159  CYTHON_FALLTHROUGH;
3160  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3161  CYTHON_FALLTHROUGH;
3162  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3163  CYTHON_FALLTHROUGH;
3164  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3165  CYTHON_FALLTHROUGH;
3166  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3167  CYTHON_FALLTHROUGH;
3168  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3169  CYTHON_FALLTHROUGH;
3170  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3171  CYTHON_FALLTHROUGH;
3172  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3173  CYTHON_FALLTHROUGH;
3174  case 0: break;
3175  default: goto __pyx_L5_argtuple_error;
3176  }
3177  kw_args = PyDict_Size(__pyx_kwds);
3178  switch (pos_args) {
3179  case 0:
3180  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3181  else goto __pyx_L5_argtuple_error;
3182  CYTHON_FALLTHROUGH;
3183  case 1:
3184  if (kw_args > 0) {
3185  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram);
3186  if (value) { values[1] = value; kw_args--; }
3187  }
3188  CYTHON_FALLTHROUGH;
3189  case 2:
3190  if (kw_args > 0) {
3191  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p);
3192  if (value) { values[2] = value; kw_args--; }
3193  }
3194  CYTHON_FALLTHROUGH;
3195  case 3:
3196  if (kw_args > 0) {
3197  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_return_info);
3198  if (value) { values[3] = value; kw_args--; }
3199  }
3200  CYTHON_FALLTHROUGH;
3201  case 4:
3202  if (kw_args > 0) {
3203  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B);
3204  if (value) { values[4] = value; kw_args--; }
3205  }
3206  CYTHON_FALLTHROUGH;
3207  case 5:
3208  if (kw_args > 0) {
3209  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C);
3210  if (value) { values[5] = value; kw_args--; }
3211  }
3212  CYTHON_FALLTHROUGH;
3213  case 6:
3214  if (kw_args > 0) {
3215  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix);
3216  if (value) { values[6] = value; kw_args--; }
3217  }
3218  CYTHON_FALLTHROUGH;
3219  case 7:
3220  if (kw_args > 0) {
3221  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples);
3222  if (value) { values[7] = value; kw_args--; }
3223  }
3224  CYTHON_FALLTHROUGH;
3225  case 8:
3226  if (kw_args > 0) {
3227  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples);
3228  if (value) { values[8] = value; kw_args--; }
3229  }
3230  CYTHON_FALLTHROUGH;
3231  case 9:
3232  if (kw_args > 0) {
3233  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol);
3234  if (value) { values[9] = value; kw_args--; }
3235  }
3236  CYTHON_FALLTHROUGH;
3237  case 10:
3238  if (kw_args > 0) {
3239  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol);
3240  if (value) { values[10] = value; kw_args--; }
3241  }
3242  CYTHON_FALLTHROUGH;
3243  case 11:
3244  if (kw_args > 0) {
3245  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level);
3246  if (value) { values[11] = value; kw_args--; }
3247  }
3248  CYTHON_FALLTHROUGH;
3249  case 12:
3250  if (kw_args > 0) {
3251  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level);
3252  if (value) { values[12] = value; kw_args--; }
3253  }
3254  CYTHON_FALLTHROUGH;
3255  case 13:
3256  if (kw_args > 0) {
3257  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol);
3258  if (value) { values[13] = value; kw_args--; }
3259  }
3260  CYTHON_FALLTHROUGH;
3261  case 14:
3262  if (kw_args > 0) {
3263  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize);
3264  if (value) { values[14] = value; kw_args--; }
3265  }
3266  CYTHON_FALLTHROUGH;
3267  case 15:
3268  if (kw_args > 0) {
3269  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed);
3270  if (value) { values[15] = value; kw_args--; }
3271  }
3272  CYTHON_FALLTHROUGH;
3273  case 16:
3274  if (kw_args > 0) {
3275  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads);
3276  if (value) { values[16] = value; kw_args--; }
3277  }
3278  CYTHON_FALLTHROUGH;
3279  case 17:
3280  if (kw_args > 0) {
3281  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_verbose);
3282  if (value) { values[17] = value; kw_args--; }
3283  }
3284  CYTHON_FALLTHROUGH;
3285  case 18:
3286  if (kw_args > 0) {
3287  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_plot);
3288  if (value) { values[18] = value; kw_args--; }
3289  }
3290  }
3291  if (unlikely(kw_args > 0)) {
3292  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "hutchinson_method") < 0)) __PYX_ERR(0, 37, __pyx_L3_error)
3293  }
3294  } else {
3295  switch (PyTuple_GET_SIZE(__pyx_args)) {
3296  case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
3297  CYTHON_FALLTHROUGH;
3298  case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
3299  CYTHON_FALLTHROUGH;
3300  case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
3301  CYTHON_FALLTHROUGH;
3302  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
3303  CYTHON_FALLTHROUGH;
3304  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
3305  CYTHON_FALLTHROUGH;
3306  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
3307  CYTHON_FALLTHROUGH;
3308  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
3309  CYTHON_FALLTHROUGH;
3310  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
3311  CYTHON_FALLTHROUGH;
3312  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
3313  CYTHON_FALLTHROUGH;
3314  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
3315  CYTHON_FALLTHROUGH;
3316  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
3317  CYTHON_FALLTHROUGH;
3318  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
3319  CYTHON_FALLTHROUGH;
3320  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
3321  CYTHON_FALLTHROUGH;
3322  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
3323  CYTHON_FALLTHROUGH;
3324  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
3325  CYTHON_FALLTHROUGH;
3326  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3327  CYTHON_FALLTHROUGH;
3328  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3329  CYTHON_FALLTHROUGH;
3330  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3331  CYTHON_FALLTHROUGH;
3332  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3333  break;
3334  default: goto __pyx_L5_argtuple_error;
3335  }
3336  }
3337  __pyx_v_A = values[0];
3338  __pyx_v_gram = values[1];
3339  __pyx_v_p = values[2];
3340  __pyx_v_return_info = values[3];
3341  __pyx_v_B = values[4];
3342  __pyx_v_C = values[5];
3343  __pyx_v_assume_matrix = values[6];
3344  __pyx_v_min_num_samples = values[7];
3345  __pyx_v_max_num_samples = values[8];
3346  __pyx_v_error_atol = values[9];
3347  __pyx_v_error_rtol = values[10];
3348  __pyx_v_confidence_level = values[11];
3349  __pyx_v_outlier_significance_level = values[12];
3350  __pyx_v_solver_tol = values[13];
3351  __pyx_v_orthogonalize = values[14];
3352  __pyx_v_seed = values[15];
3353  __pyx_v_num_threads = values[16];
3354  __pyx_v_verbose = values[17];
3355  __pyx_v_plot = values[18];
3356  }
3357  goto __pyx_L4_argument_unpacking_done;
3358  __pyx_L5_argtuple_error:;
3359  __Pyx_RaiseArgtupleInvalid("hutchinson_method", 0, 1, 19, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 37, __pyx_L3_error)
3360  __pyx_L3_error:;
3361  __Pyx_AddTraceback("imate.traceinv._hutchinson_method.hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
3362  __Pyx_RefNannyFinishContext();
3363  return NULL;
3364  __pyx_L4_argument_unpacking_done:;
3365  __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(__pyx_self, __pyx_v_A, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_B, __pyx_v_C, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot);
3366 
3367  /* "imate/traceinv/_hutchinson_method.pyx":37
3368  * # =================
3369  *
3370  * def hutchinson_method( # <<<<<<<<<<<<<<
3371  * A,
3372  * gram=False,
3373  */
3374 
3375  /* function exit code */
3376  __Pyx_RefNannyFinishContext();
3377  return __pyx_r;
3378 }
3379 
3380 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_hutchinson_method(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_return_info, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_verbose, PyObject *__pyx_v_plot) {
3381  CYTHON_UNUSED PyObject *__pyx_v_square = NULL;
3382  PyObject *__pyx_v_data_type_name = NULL;
3383  PyObject *__pyx_v_trace = NULL;
3384  PyObject *__pyx_v_error = NULL;
3385  PyObject *__pyx_v_num_outliers = NULL;
3386  PyObject *__pyx_v_samples = NULL;
3387  PyObject *__pyx_v_processed_samples_indices = NULL;
3388  CYTHON_UNUSED PyObject *__pyx_v_num_processed_samples = NULL;
3389  PyObject *__pyx_v_num_samples_used = NULL;
3390  PyObject *__pyx_v_converged = NULL;
3391  PyObject *__pyx_v_tot_wall_time = NULL;
3392  PyObject *__pyx_v_alg_wall_time = NULL;
3393  PyObject *__pyx_v_cpu_proc_time = NULL;
3394  PyObject *__pyx_v_info = NULL;
3395  PyObject *__pyx_r = NULL;
3396  __Pyx_TraceDeclarations
3397  __Pyx_RefNannyDeclarations
3398  PyObject *__pyx_t_1 = NULL;
3399  PyObject *__pyx_t_2 = NULL;
3400  PyObject *__pyx_t_3 = NULL;
3401  int __pyx_t_4;
3402  PyObject *__pyx_t_5 = NULL;
3403  PyObject *__pyx_t_6 = NULL;
3404  PyObject *(*__pyx_t_7)(PyObject *);
3405  int __pyx_t_8;
3406  int __pyx_t_9;
3407  PyObject *__pyx_t_10 = NULL;
3408  PyObject *__pyx_t_11 = NULL;
3409  PyObject *__pyx_t_12 = NULL;
3410  PyObject *__pyx_t_13 = NULL;
3411  PyObject *__pyx_t_14 = NULL;
3412  PyObject *__pyx_t_15 = NULL;
3413  PyObject *__pyx_t_16 = NULL;
3414  PyObject *__pyx_t_17 = NULL;
3415  int __pyx_lineno = 0;
3416  const char *__pyx_filename = NULL;
3417  int __pyx_clineno = 0;
3418  __Pyx_TraceFrameInit(__pyx_codeobj_)
3419  __Pyx_RefNannySetupContext("hutchinson_method", 0);
3420  __Pyx_TraceCall("hutchinson_method", __pyx_f[0], 37, 0, __PYX_ERR(0, 37, __pyx_L1_error));
3421  __Pyx_INCREF(__pyx_v_min_num_samples);
3422  __Pyx_INCREF(__pyx_v_max_num_samples);
3423  __Pyx_INCREF(__pyx_v_error_atol);
3424  __Pyx_INCREF(__pyx_v_error_rtol);
3425  __Pyx_INCREF(__pyx_v_seed);
3426  __Pyx_INCREF(__pyx_v_num_threads);
3427 
3428  /* "imate/traceinv/_hutchinson_method.pyx":614
3429  *
3430  * # Checking input arguments
3431  * error_atol, error_rtol, square = check_arguments( # <<<<<<<<<<<<<<
3432  * A, B, C, gram, p, return_info, assume_matrix, min_num_samples,
3433  * max_num_samples, error_atol, error_rtol, confidence_level,
3434  */
3435  __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L1_error))
3436  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_check_arguments); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
3437  __Pyx_GOTREF(__pyx_t_2);
3438 
3439  /* "imate/traceinv/_hutchinson_method.pyx":618
3440  * max_num_samples, error_atol, error_rtol, confidence_level,
3441  * outlier_significance_level, solver_tol, orthogonalize, seed,
3442  * num_threads, verbose, plot) # <<<<<<<<<<<<<<
3443  *
3444  * # If the number of random vectors exceed the size of the vectors they
3445  */
3446  __Pyx_TraceLine(618,0,__PYX_ERR(0, 618, __pyx_L1_error))
3447  __pyx_t_3 = NULL;
3448  __pyx_t_4 = 0;
3449  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3450  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3451  if (likely(__pyx_t_3)) {
3452  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3453  __Pyx_INCREF(__pyx_t_3);
3454  __Pyx_INCREF(function);
3455  __Pyx_DECREF_SET(__pyx_t_2, function);
3456  __pyx_t_4 = 1;
3457  }
3458  }
3459  #if CYTHON_FAST_PYCALL
3460  if (PyFunction_Check(__pyx_t_2)) {
3461  PyObject *__pyx_temp[20] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot};
3462  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 19+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3463  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3464  __Pyx_GOTREF(__pyx_t_1);
3465  } else
3466  #endif
3467  #if CYTHON_FAST_PYCCALL
3468  if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3469  PyObject *__pyx_temp[20] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_return_info, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads, __pyx_v_verbose, __pyx_v_plot};
3470  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 19+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3471  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3472  __Pyx_GOTREF(__pyx_t_1);
3473  } else
3474  #endif
3475  {
3476  __pyx_t_5 = PyTuple_New(19+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error)
3477  __Pyx_GOTREF(__pyx_t_5);
3478  if (__pyx_t_3) {
3479  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
3480  }
3481  __Pyx_INCREF(__pyx_v_A);
3482  __Pyx_GIVEREF(__pyx_v_A);
3483  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_A);
3484  __Pyx_INCREF(__pyx_v_B);
3485  __Pyx_GIVEREF(__pyx_v_B);
3486  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_B);
3487  __Pyx_INCREF(__pyx_v_C);
3488  __Pyx_GIVEREF(__pyx_v_C);
3489  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_C);
3490  __Pyx_INCREF(__pyx_v_gram);
3491  __Pyx_GIVEREF(__pyx_v_gram);
3492  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_gram);
3493  __Pyx_INCREF(__pyx_v_p);
3494  __Pyx_GIVEREF(__pyx_v_p);
3495  PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_p);
3496  __Pyx_INCREF(__pyx_v_return_info);
3497  __Pyx_GIVEREF(__pyx_v_return_info);
3498  PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_return_info);
3499  __Pyx_INCREF(__pyx_v_assume_matrix);
3500  __Pyx_GIVEREF(__pyx_v_assume_matrix);
3501  PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_assume_matrix);
3502  __Pyx_INCREF(__pyx_v_min_num_samples);
3503  __Pyx_GIVEREF(__pyx_v_min_num_samples);
3504  PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_min_num_samples);
3505  __Pyx_INCREF(__pyx_v_max_num_samples);
3506  __Pyx_GIVEREF(__pyx_v_max_num_samples);
3507  PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_max_num_samples);
3508  __Pyx_INCREF(__pyx_v_error_atol);
3509  __Pyx_GIVEREF(__pyx_v_error_atol);
3510  PyTuple_SET_ITEM(__pyx_t_5, 9+__pyx_t_4, __pyx_v_error_atol);
3511  __Pyx_INCREF(__pyx_v_error_rtol);
3512  __Pyx_GIVEREF(__pyx_v_error_rtol);
3513  PyTuple_SET_ITEM(__pyx_t_5, 10+__pyx_t_4, __pyx_v_error_rtol);
3514  __Pyx_INCREF(__pyx_v_confidence_level);
3515  __Pyx_GIVEREF(__pyx_v_confidence_level);
3516  PyTuple_SET_ITEM(__pyx_t_5, 11+__pyx_t_4, __pyx_v_confidence_level);
3517  __Pyx_INCREF(__pyx_v_outlier_significance_level);
3518  __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
3519  PyTuple_SET_ITEM(__pyx_t_5, 12+__pyx_t_4, __pyx_v_outlier_significance_level);
3520  __Pyx_INCREF(__pyx_v_solver_tol);
3521  __Pyx_GIVEREF(__pyx_v_solver_tol);
3522  PyTuple_SET_ITEM(__pyx_t_5, 13+__pyx_t_4, __pyx_v_solver_tol);
3523  __Pyx_INCREF(__pyx_v_orthogonalize);
3524  __Pyx_GIVEREF(__pyx_v_orthogonalize);
3525  PyTuple_SET_ITEM(__pyx_t_5, 14+__pyx_t_4, __pyx_v_orthogonalize);
3526  __Pyx_INCREF(__pyx_v_seed);
3527  __Pyx_GIVEREF(__pyx_v_seed);
3528  PyTuple_SET_ITEM(__pyx_t_5, 15+__pyx_t_4, __pyx_v_seed);
3529  __Pyx_INCREF(__pyx_v_num_threads);
3530  __Pyx_GIVEREF(__pyx_v_num_threads);
3531  PyTuple_SET_ITEM(__pyx_t_5, 16+__pyx_t_4, __pyx_v_num_threads);
3532  __Pyx_INCREF(__pyx_v_verbose);
3533  __Pyx_GIVEREF(__pyx_v_verbose);
3534  PyTuple_SET_ITEM(__pyx_t_5, 17+__pyx_t_4, __pyx_v_verbose);
3535  __Pyx_INCREF(__pyx_v_plot);
3536  __Pyx_GIVEREF(__pyx_v_plot);
3537  PyTuple_SET_ITEM(__pyx_t_5, 18+__pyx_t_4, __pyx_v_plot);
3538  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 614, __pyx_L1_error)
3539  __Pyx_GOTREF(__pyx_t_1);
3540  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3541  }
3542  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3543  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3544  PyObject* sequence = __pyx_t_1;
3545  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3546  if (unlikely(size != 3)) {
3547  if (size > 3) __Pyx_RaiseTooManyValuesError(3);
3548  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3549  __PYX_ERR(0, 614, __pyx_L1_error)
3550  }
3551  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3552  if (likely(PyTuple_CheckExact(sequence))) {
3553  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0);
3554  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
3555  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
3556  } else {
3557  __pyx_t_2 = PyList_GET_ITEM(sequence, 0);
3558  __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
3559  __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
3560  }
3561  __Pyx_INCREF(__pyx_t_2);
3562  __Pyx_INCREF(__pyx_t_5);
3563  __Pyx_INCREF(__pyx_t_3);
3564  #else
3565  __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 614, __pyx_L1_error)
3566  __Pyx_GOTREF(__pyx_t_2);
3567  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 614, __pyx_L1_error)
3568  __Pyx_GOTREF(__pyx_t_5);
3569  __pyx_t_3 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 614, __pyx_L1_error)
3570  __Pyx_GOTREF(__pyx_t_3);
3571  #endif
3572  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3573  } else {
3574  Py_ssize_t index = -1;
3575  __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 614, __pyx_L1_error)
3576  __Pyx_GOTREF(__pyx_t_6);
3577  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3578  __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
3579  index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed;
3580  __Pyx_GOTREF(__pyx_t_2);
3581  index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L3_unpacking_failed;
3582  __Pyx_GOTREF(__pyx_t_5);
3583  index = 2; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed;
3584  __Pyx_GOTREF(__pyx_t_3);
3585  if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 3) < 0) __PYX_ERR(0, 614, __pyx_L1_error)
3586  __pyx_t_7 = NULL;
3587  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3588  goto __pyx_L4_unpacking_done;
3589  __pyx_L3_unpacking_failed:;
3590  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3591  __pyx_t_7 = NULL;
3592  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
3593  __PYX_ERR(0, 614, __pyx_L1_error)
3594  __pyx_L4_unpacking_done:;
3595  }
3596 
3597  /* "imate/traceinv/_hutchinson_method.pyx":614
3598  *
3599  * # Checking input arguments
3600  * error_atol, error_rtol, square = check_arguments( # <<<<<<<<<<<<<<
3601  * A, B, C, gram, p, return_info, assume_matrix, min_num_samples,
3602  * max_num_samples, error_atol, error_rtol, confidence_level,
3603  */
3604  __Pyx_TraceLine(614,0,__PYX_ERR(0, 614, __pyx_L1_error))
3605  __Pyx_DECREF_SET(__pyx_v_error_atol, __pyx_t_2);
3606  __pyx_t_2 = 0;
3607  __Pyx_DECREF_SET(__pyx_v_error_rtol, __pyx_t_5);
3608  __pyx_t_5 = 0;
3609  __pyx_v_square = __pyx_t_3;
3610  __pyx_t_3 = 0;
3611 
3612  /* "imate/traceinv/_hutchinson_method.pyx":623
3613  * # cannot be linearly independent and extra calculation with them will be
3614  * # redundant.
3615  * if A.shape[1] < max_num_samples: # <<<<<<<<<<<<<<
3616  * max_num_samples = A.shape[1]
3617  * if A.shape[1] < min_num_samples:
3618  */
3619  __Pyx_TraceLine(623,0,__PYX_ERR(0, 623, __pyx_L1_error))
3620  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
3621  __Pyx_GOTREF(__pyx_t_1);
3622  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 623, __pyx_L1_error)
3623  __Pyx_GOTREF(__pyx_t_3);
3624  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3625  __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, __pyx_v_max_num_samples, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 623, __pyx_L1_error)
3626  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3627  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 623, __pyx_L1_error)
3628  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3629  if (__pyx_t_8) {
3630 
3631  /* "imate/traceinv/_hutchinson_method.pyx":624
3632  * # redundant.
3633  * if A.shape[1] < max_num_samples:
3634  * max_num_samples = A.shape[1] # <<<<<<<<<<<<<<
3635  * if A.shape[1] < min_num_samples:
3636  * min_num_samples = A.shape[1]
3637  */
3638  __Pyx_TraceLine(624,0,__PYX_ERR(0, 624, __pyx_L1_error))
3639  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 624, __pyx_L1_error)
3640  __Pyx_GOTREF(__pyx_t_1);
3641  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 624, __pyx_L1_error)
3642  __Pyx_GOTREF(__pyx_t_3);
3643  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3644  __Pyx_DECREF_SET(__pyx_v_max_num_samples, __pyx_t_3);
3645  __pyx_t_3 = 0;
3646 
3647  /* "imate/traceinv/_hutchinson_method.pyx":623
3648  * # cannot be linearly independent and extra calculation with them will be
3649  * # redundant.
3650  * if A.shape[1] < max_num_samples: # <<<<<<<<<<<<<<
3651  * max_num_samples = A.shape[1]
3652  * if A.shape[1] < min_num_samples:
3653  */
3654  }
3655 
3656  /* "imate/traceinv/_hutchinson_method.pyx":625
3657  * if A.shape[1] < max_num_samples:
3658  * max_num_samples = A.shape[1]
3659  * if A.shape[1] < min_num_samples: # <<<<<<<<<<<<<<
3660  * min_num_samples = A.shape[1]
3661  *
3662  */
3663  __Pyx_TraceLine(625,0,__PYX_ERR(0, 625, __pyx_L1_error))
3664  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
3665  __Pyx_GOTREF(__pyx_t_3);
3666  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 625, __pyx_L1_error)
3667  __Pyx_GOTREF(__pyx_t_1);
3668  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3669  __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_v_min_num_samples, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 625, __pyx_L1_error)
3670  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3671  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 625, __pyx_L1_error)
3672  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3673  if (__pyx_t_8) {
3674 
3675  /* "imate/traceinv/_hutchinson_method.pyx":626
3676  * max_num_samples = A.shape[1]
3677  * if A.shape[1] < min_num_samples:
3678  * min_num_samples = A.shape[1] # <<<<<<<<<<<<<<
3679  *
3680  * # Seed value None means using processor time as seed. This is indicated by
3681  */
3682  __Pyx_TraceLine(626,0,__PYX_ERR(0, 626, __pyx_L1_error))
3683  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 626, __pyx_L1_error)
3684  __Pyx_GOTREF(__pyx_t_3);
3685  __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 626, __pyx_L1_error)
3686  __Pyx_GOTREF(__pyx_t_1);
3687  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3688  __Pyx_DECREF_SET(__pyx_v_min_num_samples, __pyx_t_1);
3689  __pyx_t_1 = 0;
3690 
3691  /* "imate/traceinv/_hutchinson_method.pyx":625
3692  * if A.shape[1] < max_num_samples:
3693  * max_num_samples = A.shape[1]
3694  * if A.shape[1] < min_num_samples: # <<<<<<<<<<<<<<
3695  * min_num_samples = A.shape[1]
3696  *
3697  */
3698  }
3699 
3700  /* "imate/traceinv/_hutchinson_method.pyx":630
3701  * # Seed value None means using processor time as seed. This is indicated by
3702  * # a inegative integer in the C part of the code.
3703  * if seed is None: # <<<<<<<<<<<<<<
3704  * seed = -1
3705  *
3706  */
3707  __Pyx_TraceLine(630,0,__PYX_ERR(0, 630, __pyx_L1_error))
3708  __pyx_t_8 = (__pyx_v_seed == Py_None);
3709  __pyx_t_9 = (__pyx_t_8 != 0);
3710  if (__pyx_t_9) {
3711 
3712  /* "imate/traceinv/_hutchinson_method.pyx":631
3713  * # a inegative integer in the C part of the code.
3714  * if seed is None:
3715  * seed = -1 # <<<<<<<<<<<<<<
3716  *
3717  * # Parallel processing
3718  */
3719  __Pyx_TraceLine(631,0,__PYX_ERR(0, 631, __pyx_L1_error))
3720  __Pyx_INCREF(__pyx_int_neg_1);
3721  __Pyx_DECREF_SET(__pyx_v_seed, __pyx_int_neg_1);
3722 
3723  /* "imate/traceinv/_hutchinson_method.pyx":630
3724  * # Seed value None means using processor time as seed. This is indicated by
3725  * # a inegative integer in the C part of the code.
3726  * if seed is None: # <<<<<<<<<<<<<<
3727  * seed = -1
3728  *
3729  */
3730  }
3731 
3732  /* "imate/traceinv/_hutchinson_method.pyx":634
3733  *
3734  * # Parallel processing
3735  * if num_threads < 1: # <<<<<<<<<<<<<<
3736  * num_threads = multiprocessing.cpu_count()
3737  *
3738  */
3739  __Pyx_TraceLine(634,0,__PYX_ERR(0, 634, __pyx_L1_error))
3740  __pyx_t_1 = PyObject_RichCompare(__pyx_v_num_threads, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 634, __pyx_L1_error)
3741  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 634, __pyx_L1_error)
3742  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3743  if (__pyx_t_9) {
3744 
3745  /* "imate/traceinv/_hutchinson_method.pyx":635
3746  * # Parallel processing
3747  * if num_threads < 1:
3748  * num_threads = multiprocessing.cpu_count() # <<<<<<<<<<<<<<
3749  *
3750  * # Dispatch depending on 32-bit or 64-bit
3751  */
3752  __Pyx_TraceLine(635,0,__PYX_ERR(0, 635, __pyx_L1_error))
3753  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_multiprocessing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 635, __pyx_L1_error)
3754  __Pyx_GOTREF(__pyx_t_3);
3755  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_cpu_count); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 635, __pyx_L1_error)
3756  __Pyx_GOTREF(__pyx_t_5);
3757  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3758  __pyx_t_3 = NULL;
3759  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3760  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3761  if (likely(__pyx_t_3)) {
3762  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3763  __Pyx_INCREF(__pyx_t_3);
3764  __Pyx_INCREF(function);
3765  __Pyx_DECREF_SET(__pyx_t_5, function);
3766  }
3767  }
3768  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
3769  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3770  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 635, __pyx_L1_error)
3771  __Pyx_GOTREF(__pyx_t_1);
3772  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3773  __Pyx_DECREF_SET(__pyx_v_num_threads, __pyx_t_1);
3774  __pyx_t_1 = 0;
3775 
3776  /* "imate/traceinv/_hutchinson_method.pyx":634
3777  *
3778  * # Parallel processing
3779  * if num_threads < 1: # <<<<<<<<<<<<<<
3780  * num_threads = multiprocessing.cpu_count()
3781  *
3782  */
3783  }
3784 
3785  /* "imate/traceinv/_hutchinson_method.pyx":638
3786  *
3787  * # Dispatch depending on 32-bit or 64-bit
3788  * data_type_name = get_data_type_name(A) # <<<<<<<<<<<<<<
3789  * if data_type_name == b'float32':
3790  * trace, error, num_outliers, samples, processed_samples_indices, \
3791  */
3792  __Pyx_TraceLine(638,0,__PYX_ERR(0, 638, __pyx_L1_error))
3793  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_get_data_type_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error)
3794  __Pyx_GOTREF(__pyx_t_5);
3795  __pyx_t_3 = NULL;
3796  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3797  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3798  if (likely(__pyx_t_3)) {
3799  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3800  __Pyx_INCREF(__pyx_t_3);
3801  __Pyx_INCREF(function);
3802  __Pyx_DECREF_SET(__pyx_t_5, function);
3803  }
3804  }
3805  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_3, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_A);
3806  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3807  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 638, __pyx_L1_error)
3808  __Pyx_GOTREF(__pyx_t_1);
3809  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3810  __pyx_v_data_type_name = __pyx_t_1;
3811  __pyx_t_1 = 0;
3812 
3813  /* "imate/traceinv/_hutchinson_method.pyx":639
3814  * # Dispatch depending on 32-bit or 64-bit
3815  * data_type_name = get_data_type_name(A)
3816  * if data_type_name == b'float32': # <<<<<<<<<<<<<<
3817  * trace, error, num_outliers, samples, processed_samples_indices, \
3818  * num_processed_samples, num_samples_used, converged, \
3819  */
3820  __Pyx_TraceLine(639,0,__PYX_ERR(0, 639, __pyx_L1_error))
3821  __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float32, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 639, __pyx_L1_error)
3822  if (__pyx_t_9) {
3823 
3824  /* "imate/traceinv/_hutchinson_method.pyx":643
3825  * num_processed_samples, num_samples_used, converged, \
3826  * tot_wall_time, alg_wall_time, cpu_proc_time = \
3827  * _hutchinson_method_float(A, B, C, gram, p, assume_matrix, # <<<<<<<<<<<<<<
3828  * min_num_samples, max_num_samples,
3829  * error_atol, error_rtol,
3830  */
3831  __Pyx_TraceLine(643,0,__PYX_ERR(0, 643, __pyx_L1_error))
3832  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_hutchinson_method_float); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error)
3833  __Pyx_GOTREF(__pyx_t_5);
3834 
3835  /* "imate/traceinv/_hutchinson_method.pyx":649
3836  * outlier_significance_level,
3837  * solver_tol, orthogonalize, seed,
3838  * num_threads) # <<<<<<<<<<<<<<
3839  *
3840  * elif data_type_name == b'float64':
3841  */
3842  __Pyx_TraceLine(649,0,__PYX_ERR(0, 649, __pyx_L1_error))
3843  __pyx_t_3 = NULL;
3844  __pyx_t_4 = 0;
3845  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3846  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
3847  if (likely(__pyx_t_3)) {
3848  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3849  __Pyx_INCREF(__pyx_t_3);
3850  __Pyx_INCREF(function);
3851  __Pyx_DECREF_SET(__pyx_t_5, function);
3852  __pyx_t_4 = 1;
3853  }
3854  }
3855  #if CYTHON_FAST_PYCALL
3856  if (PyFunction_Check(__pyx_t_5)) {
3857  PyObject *__pyx_temp[17] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
3858  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3859  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3860  __Pyx_GOTREF(__pyx_t_1);
3861  } else
3862  #endif
3863  #if CYTHON_FAST_PYCCALL
3864  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
3865  PyObject *__pyx_temp[17] = {__pyx_t_3, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
3866  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3867  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3868  __Pyx_GOTREF(__pyx_t_1);
3869  } else
3870  #endif
3871  {
3872  __pyx_t_2 = PyTuple_New(16+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 643, __pyx_L1_error)
3873  __Pyx_GOTREF(__pyx_t_2);
3874  if (__pyx_t_3) {
3875  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
3876  }
3877  __Pyx_INCREF(__pyx_v_A);
3878  __Pyx_GIVEREF(__pyx_v_A);
3879  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, __pyx_v_A);
3880  __Pyx_INCREF(__pyx_v_B);
3881  __Pyx_GIVEREF(__pyx_v_B);
3882  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_B);
3883  __Pyx_INCREF(__pyx_v_C);
3884  __Pyx_GIVEREF(__pyx_v_C);
3885  PyTuple_SET_ITEM(__pyx_t_2, 2+__pyx_t_4, __pyx_v_C);
3886  __Pyx_INCREF(__pyx_v_gram);
3887  __Pyx_GIVEREF(__pyx_v_gram);
3888  PyTuple_SET_ITEM(__pyx_t_2, 3+__pyx_t_4, __pyx_v_gram);
3889  __Pyx_INCREF(__pyx_v_p);
3890  __Pyx_GIVEREF(__pyx_v_p);
3891  PyTuple_SET_ITEM(__pyx_t_2, 4+__pyx_t_4, __pyx_v_p);
3892  __Pyx_INCREF(__pyx_v_assume_matrix);
3893  __Pyx_GIVEREF(__pyx_v_assume_matrix);
3894  PyTuple_SET_ITEM(__pyx_t_2, 5+__pyx_t_4, __pyx_v_assume_matrix);
3895  __Pyx_INCREF(__pyx_v_min_num_samples);
3896  __Pyx_GIVEREF(__pyx_v_min_num_samples);
3897  PyTuple_SET_ITEM(__pyx_t_2, 6+__pyx_t_4, __pyx_v_min_num_samples);
3898  __Pyx_INCREF(__pyx_v_max_num_samples);
3899  __Pyx_GIVEREF(__pyx_v_max_num_samples);
3900  PyTuple_SET_ITEM(__pyx_t_2, 7+__pyx_t_4, __pyx_v_max_num_samples);
3901  __Pyx_INCREF(__pyx_v_error_atol);
3902  __Pyx_GIVEREF(__pyx_v_error_atol);
3903  PyTuple_SET_ITEM(__pyx_t_2, 8+__pyx_t_4, __pyx_v_error_atol);
3904  __Pyx_INCREF(__pyx_v_error_rtol);
3905  __Pyx_GIVEREF(__pyx_v_error_rtol);
3906  PyTuple_SET_ITEM(__pyx_t_2, 9+__pyx_t_4, __pyx_v_error_rtol);
3907  __Pyx_INCREF(__pyx_v_confidence_level);
3908  __Pyx_GIVEREF(__pyx_v_confidence_level);
3909  PyTuple_SET_ITEM(__pyx_t_2, 10+__pyx_t_4, __pyx_v_confidence_level);
3910  __Pyx_INCREF(__pyx_v_outlier_significance_level);
3911  __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
3912  PyTuple_SET_ITEM(__pyx_t_2, 11+__pyx_t_4, __pyx_v_outlier_significance_level);
3913  __Pyx_INCREF(__pyx_v_solver_tol);
3914  __Pyx_GIVEREF(__pyx_v_solver_tol);
3915  PyTuple_SET_ITEM(__pyx_t_2, 12+__pyx_t_4, __pyx_v_solver_tol);
3916  __Pyx_INCREF(__pyx_v_orthogonalize);
3917  __Pyx_GIVEREF(__pyx_v_orthogonalize);
3918  PyTuple_SET_ITEM(__pyx_t_2, 13+__pyx_t_4, __pyx_v_orthogonalize);
3919  __Pyx_INCREF(__pyx_v_seed);
3920  __Pyx_GIVEREF(__pyx_v_seed);
3921  PyTuple_SET_ITEM(__pyx_t_2, 14+__pyx_t_4, __pyx_v_seed);
3922  __Pyx_INCREF(__pyx_v_num_threads);
3923  __Pyx_GIVEREF(__pyx_v_num_threads);
3924  PyTuple_SET_ITEM(__pyx_t_2, 15+__pyx_t_4, __pyx_v_num_threads);
3925  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 643, __pyx_L1_error)
3926  __Pyx_GOTREF(__pyx_t_1);
3927  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3928  }
3929  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3930  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
3931  PyObject* sequence = __pyx_t_1;
3932  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
3933  if (unlikely(size != 11)) {
3934  if (size > 11) __Pyx_RaiseTooManyValuesError(11);
3935  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
3936  __PYX_ERR(0, 640, __pyx_L1_error)
3937  }
3938  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3939  if (likely(PyTuple_CheckExact(sequence))) {
3940  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0);
3941  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1);
3942  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 2);
3943  __pyx_t_6 = PyTuple_GET_ITEM(sequence, 3);
3944  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 4);
3945  __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5);
3946  __pyx_t_12 = PyTuple_GET_ITEM(sequence, 6);
3947  __pyx_t_13 = PyTuple_GET_ITEM(sequence, 7);
3948  __pyx_t_14 = PyTuple_GET_ITEM(sequence, 8);
3949  __pyx_t_15 = PyTuple_GET_ITEM(sequence, 9);
3950  __pyx_t_16 = PyTuple_GET_ITEM(sequence, 10);
3951  } else {
3952  __pyx_t_5 = PyList_GET_ITEM(sequence, 0);
3953  __pyx_t_2 = PyList_GET_ITEM(sequence, 1);
3954  __pyx_t_3 = PyList_GET_ITEM(sequence, 2);
3955  __pyx_t_6 = PyList_GET_ITEM(sequence, 3);
3956  __pyx_t_10 = PyList_GET_ITEM(sequence, 4);
3957  __pyx_t_11 = PyList_GET_ITEM(sequence, 5);
3958  __pyx_t_12 = PyList_GET_ITEM(sequence, 6);
3959  __pyx_t_13 = PyList_GET_ITEM(sequence, 7);
3960  __pyx_t_14 = PyList_GET_ITEM(sequence, 8);
3961  __pyx_t_15 = PyList_GET_ITEM(sequence, 9);
3962  __pyx_t_16 = PyList_GET_ITEM(sequence, 10);
3963  }
3964  __Pyx_INCREF(__pyx_t_5);
3965  __Pyx_INCREF(__pyx_t_2);
3966  __Pyx_INCREF(__pyx_t_3);
3967  __Pyx_INCREF(__pyx_t_6);
3968  __Pyx_INCREF(__pyx_t_10);
3969  __Pyx_INCREF(__pyx_t_11);
3970  __Pyx_INCREF(__pyx_t_12);
3971  __Pyx_INCREF(__pyx_t_13);
3972  __Pyx_INCREF(__pyx_t_14);
3973  __Pyx_INCREF(__pyx_t_15);
3974  __Pyx_INCREF(__pyx_t_16);
3975  #else
3976  {
3977  Py_ssize_t i;
3978  PyObject** temps[11] = {&__pyx_t_5,&__pyx_t_2,&__pyx_t_3,&__pyx_t_6,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16};
3979  for (i=0; i < 11; i++) {
3980  PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 640, __pyx_L1_error)
3981  __Pyx_GOTREF(item);
3982  *(temps[i]) = item;
3983  }
3984  }
3985  #endif
3986  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3987  } else {
3988  Py_ssize_t index = -1;
3989  PyObject** temps[11] = {&__pyx_t_5,&__pyx_t_2,&__pyx_t_3,&__pyx_t_6,&__pyx_t_10,&__pyx_t_11,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14,&__pyx_t_15,&__pyx_t_16};
3990  __pyx_t_17 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 640, __pyx_L1_error)
3991  __Pyx_GOTREF(__pyx_t_17);
3992  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3993  __pyx_t_7 = Py_TYPE(__pyx_t_17)->tp_iternext;
3994  for (index=0; index < 11; index++) {
3995  PyObject* item = __pyx_t_7(__pyx_t_17); if (unlikely(!item)) goto __pyx_L10_unpacking_failed;
3996  __Pyx_GOTREF(item);
3997  *(temps[index]) = item;
3998  }
3999  if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_17), 11) < 0) __PYX_ERR(0, 640, __pyx_L1_error)
4000  __pyx_t_7 = NULL;
4001  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4002  goto __pyx_L11_unpacking_done;
4003  __pyx_L10_unpacking_failed:;
4004  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4005  __pyx_t_7 = NULL;
4006  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4007  __PYX_ERR(0, 640, __pyx_L1_error)
4008  __pyx_L11_unpacking_done:;
4009  }
4010 
4011  /* "imate/traceinv/_hutchinson_method.pyx":640
4012  * data_type_name = get_data_type_name(A)
4013  * if data_type_name == b'float32':
4014  * trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
4015  * num_processed_samples, num_samples_used, converged, \
4016  * tot_wall_time, alg_wall_time, cpu_proc_time = \
4017  */
4018  __Pyx_TraceLine(640,0,__PYX_ERR(0, 640, __pyx_L1_error))
4019  __pyx_v_trace = __pyx_t_5;
4020  __pyx_t_5 = 0;
4021  __pyx_v_error = __pyx_t_2;
4022  __pyx_t_2 = 0;
4023  __pyx_v_num_outliers = __pyx_t_3;
4024  __pyx_t_3 = 0;
4025  __pyx_v_samples = __pyx_t_6;
4026  __pyx_t_6 = 0;
4027  __pyx_v_processed_samples_indices = __pyx_t_10;
4028  __pyx_t_10 = 0;
4029  __pyx_v_num_processed_samples = __pyx_t_11;
4030  __pyx_t_11 = 0;
4031  __pyx_v_num_samples_used = __pyx_t_12;
4032  __pyx_t_12 = 0;
4033  __pyx_v_converged = __pyx_t_13;
4034  __pyx_t_13 = 0;
4035  __pyx_v_tot_wall_time = __pyx_t_14;
4036  __pyx_t_14 = 0;
4037  __pyx_v_alg_wall_time = __pyx_t_15;
4038  __pyx_t_15 = 0;
4039  __pyx_v_cpu_proc_time = __pyx_t_16;
4040  __pyx_t_16 = 0;
4041 
4042  /* "imate/traceinv/_hutchinson_method.pyx":639
4043  * # Dispatch depending on 32-bit or 64-bit
4044  * data_type_name = get_data_type_name(A)
4045  * if data_type_name == b'float32': # <<<<<<<<<<<<<<
4046  * trace, error, num_outliers, samples, processed_samples_indices, \
4047  * num_processed_samples, num_samples_used, converged, \
4048  */
4049  goto __pyx_L9;
4050  }
4051 
4052  /* "imate/traceinv/_hutchinson_method.pyx":651
4053  * num_threads)
4054  *
4055  * elif data_type_name == b'float64': # <<<<<<<<<<<<<<
4056  * trace, error, num_outliers, samples, processed_samples_indices, \
4057  * num_processed_samples, num_samples_used, converged, \
4058  */
4059  __Pyx_TraceLine(651,0,__PYX_ERR(0, 651, __pyx_L1_error))
4060  __pyx_t_9 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float64, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 651, __pyx_L1_error)
4061  if (likely(__pyx_t_9)) {
4062 
4063  /* "imate/traceinv/_hutchinson_method.pyx":655
4064  * num_processed_samples, num_samples_used, converged, \
4065  * tot_wall_time, alg_wall_time, cpu_proc_time = \
4066  * _hutchinson_method_double(A, B, C, gram, p, assume_matrix, # <<<<<<<<<<<<<<
4067  * min_num_samples, max_num_samples,
4068  * error_atol, error_rtol,
4069  */
4070  __Pyx_TraceLine(655,0,__PYX_ERR(0, 655, __pyx_L1_error))
4071  __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_hutchinson_method_double); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 655, __pyx_L1_error)
4072  __Pyx_GOTREF(__pyx_t_16);
4073 
4074  /* "imate/traceinv/_hutchinson_method.pyx":661
4075  * outlier_significance_level,
4076  * solver_tol, orthogonalize, seed,
4077  * num_threads) # <<<<<<<<<<<<<<
4078  * else:
4079  * raise TypeError('Data type should be either "float32" or "float64"')
4080  */
4081  __Pyx_TraceLine(661,0,__PYX_ERR(0, 661, __pyx_L1_error))
4082  __pyx_t_15 = NULL;
4083  __pyx_t_4 = 0;
4084  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_16))) {
4085  __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_16);
4086  if (likely(__pyx_t_15)) {
4087  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
4088  __Pyx_INCREF(__pyx_t_15);
4089  __Pyx_INCREF(function);
4090  __Pyx_DECREF_SET(__pyx_t_16, function);
4091  __pyx_t_4 = 1;
4092  }
4093  }
4094  #if CYTHON_FAST_PYCALL
4095  if (PyFunction_Check(__pyx_t_16)) {
4096  PyObject *__pyx_temp[17] = {__pyx_t_15, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
4097  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4098  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
4099  __Pyx_GOTREF(__pyx_t_1);
4100  } else
4101  #endif
4102  #if CYTHON_FAST_PYCCALL
4103  if (__Pyx_PyFastCFunction_Check(__pyx_t_16)) {
4104  PyObject *__pyx_temp[17] = {__pyx_t_15, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads};
4105  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_16, __pyx_temp+1-__pyx_t_4, 16+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4106  __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0;
4107  __Pyx_GOTREF(__pyx_t_1);
4108  } else
4109  #endif
4110  {
4111  __pyx_t_14 = PyTuple_New(16+__pyx_t_4); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 655, __pyx_L1_error)
4112  __Pyx_GOTREF(__pyx_t_14);
4113  if (__pyx_t_15) {
4114  __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __pyx_t_15 = NULL;
4115  }
4116  __Pyx_INCREF(__pyx_v_A);
4117  __Pyx_GIVEREF(__pyx_v_A);
4118  PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_4, __pyx_v_A);
4119  __Pyx_INCREF(__pyx_v_B);
4120  __Pyx_GIVEREF(__pyx_v_B);
4121  PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_4, __pyx_v_B);
4122  __Pyx_INCREF(__pyx_v_C);
4123  __Pyx_GIVEREF(__pyx_v_C);
4124  PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_4, __pyx_v_C);
4125  __Pyx_INCREF(__pyx_v_gram);
4126  __Pyx_GIVEREF(__pyx_v_gram);
4127  PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_4, __pyx_v_gram);
4128  __Pyx_INCREF(__pyx_v_p);
4129  __Pyx_GIVEREF(__pyx_v_p);
4130  PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_4, __pyx_v_p);
4131  __Pyx_INCREF(__pyx_v_assume_matrix);
4132  __Pyx_GIVEREF(__pyx_v_assume_matrix);
4133  PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_4, __pyx_v_assume_matrix);
4134  __Pyx_INCREF(__pyx_v_min_num_samples);
4135  __Pyx_GIVEREF(__pyx_v_min_num_samples);
4136  PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_4, __pyx_v_min_num_samples);
4137  __Pyx_INCREF(__pyx_v_max_num_samples);
4138  __Pyx_GIVEREF(__pyx_v_max_num_samples);
4139  PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_4, __pyx_v_max_num_samples);
4140  __Pyx_INCREF(__pyx_v_error_atol);
4141  __Pyx_GIVEREF(__pyx_v_error_atol);
4142  PyTuple_SET_ITEM(__pyx_t_14, 8+__pyx_t_4, __pyx_v_error_atol);
4143  __Pyx_INCREF(__pyx_v_error_rtol);
4144  __Pyx_GIVEREF(__pyx_v_error_rtol);
4145  PyTuple_SET_ITEM(__pyx_t_14, 9+__pyx_t_4, __pyx_v_error_rtol);
4146  __Pyx_INCREF(__pyx_v_confidence_level);
4147  __Pyx_GIVEREF(__pyx_v_confidence_level);
4148  PyTuple_SET_ITEM(__pyx_t_14, 10+__pyx_t_4, __pyx_v_confidence_level);
4149  __Pyx_INCREF(__pyx_v_outlier_significance_level);
4150  __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
4151  PyTuple_SET_ITEM(__pyx_t_14, 11+__pyx_t_4, __pyx_v_outlier_significance_level);
4152  __Pyx_INCREF(__pyx_v_solver_tol);
4153  __Pyx_GIVEREF(__pyx_v_solver_tol);
4154  PyTuple_SET_ITEM(__pyx_t_14, 12+__pyx_t_4, __pyx_v_solver_tol);
4155  __Pyx_INCREF(__pyx_v_orthogonalize);
4156  __Pyx_GIVEREF(__pyx_v_orthogonalize);
4157  PyTuple_SET_ITEM(__pyx_t_14, 13+__pyx_t_4, __pyx_v_orthogonalize);
4158  __Pyx_INCREF(__pyx_v_seed);
4159  __Pyx_GIVEREF(__pyx_v_seed);
4160  PyTuple_SET_ITEM(__pyx_t_14, 14+__pyx_t_4, __pyx_v_seed);
4161  __Pyx_INCREF(__pyx_v_num_threads);
4162  __Pyx_GIVEREF(__pyx_v_num_threads);
4163  PyTuple_SET_ITEM(__pyx_t_14, 15+__pyx_t_4, __pyx_v_num_threads);
4164  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_16, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 655, __pyx_L1_error)
4165  __Pyx_GOTREF(__pyx_t_1);
4166  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4167  }
4168  __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
4169  if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
4170  PyObject* sequence = __pyx_t_1;
4171  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
4172  if (unlikely(size != 11)) {
4173  if (size > 11) __Pyx_RaiseTooManyValuesError(11);
4174  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
4175  __PYX_ERR(0, 652, __pyx_L1_error)
4176  }
4177  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4178  if (likely(PyTuple_CheckExact(sequence))) {
4179  __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0);
4180  __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1);
4181  __pyx_t_15 = PyTuple_GET_ITEM(sequence, 2);
4182  __pyx_t_13 = PyTuple_GET_ITEM(sequence, 3);
4183  __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4);
4184  __pyx_t_11 = PyTuple_GET_ITEM(sequence, 5);
4185  __pyx_t_10 = PyTuple_GET_ITEM(sequence, 6);
4186  __pyx_t_6 = PyTuple_GET_ITEM(sequence, 7);
4187  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 8);
4188  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 9);
4189  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 10);
4190  } else {
4191  __pyx_t_16 = PyList_GET_ITEM(sequence, 0);
4192  __pyx_t_14 = PyList_GET_ITEM(sequence, 1);
4193  __pyx_t_15 = PyList_GET_ITEM(sequence, 2);
4194  __pyx_t_13 = PyList_GET_ITEM(sequence, 3);
4195  __pyx_t_12 = PyList_GET_ITEM(sequence, 4);
4196  __pyx_t_11 = PyList_GET_ITEM(sequence, 5);
4197  __pyx_t_10 = PyList_GET_ITEM(sequence, 6);
4198  __pyx_t_6 = PyList_GET_ITEM(sequence, 7);
4199  __pyx_t_3 = PyList_GET_ITEM(sequence, 8);
4200  __pyx_t_2 = PyList_GET_ITEM(sequence, 9);
4201  __pyx_t_5 = PyList_GET_ITEM(sequence, 10);
4202  }
4203  __Pyx_INCREF(__pyx_t_16);
4204  __Pyx_INCREF(__pyx_t_14);
4205  __Pyx_INCREF(__pyx_t_15);
4206  __Pyx_INCREF(__pyx_t_13);
4207  __Pyx_INCREF(__pyx_t_12);
4208  __Pyx_INCREF(__pyx_t_11);
4209  __Pyx_INCREF(__pyx_t_10);
4210  __Pyx_INCREF(__pyx_t_6);
4211  __Pyx_INCREF(__pyx_t_3);
4212  __Pyx_INCREF(__pyx_t_2);
4213  __Pyx_INCREF(__pyx_t_5);
4214  #else
4215  {
4216  Py_ssize_t i;
4217  PyObject** temps[11] = {&__pyx_t_16,&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_6,&__pyx_t_3,&__pyx_t_2,&__pyx_t_5};
4218  for (i=0; i < 11; i++) {
4219  PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 652, __pyx_L1_error)
4220  __Pyx_GOTREF(item);
4221  *(temps[i]) = item;
4222  }
4223  }
4224  #endif
4225  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4226  } else {
4227  Py_ssize_t index = -1;
4228  PyObject** temps[11] = {&__pyx_t_16,&__pyx_t_14,&__pyx_t_15,&__pyx_t_13,&__pyx_t_12,&__pyx_t_11,&__pyx_t_10,&__pyx_t_6,&__pyx_t_3,&__pyx_t_2,&__pyx_t_5};
4229  __pyx_t_17 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 652, __pyx_L1_error)
4230  __Pyx_GOTREF(__pyx_t_17);
4231  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4232  __pyx_t_7 = Py_TYPE(__pyx_t_17)->tp_iternext;
4233  for (index=0; index < 11; index++) {
4234  PyObject* item = __pyx_t_7(__pyx_t_17); if (unlikely(!item)) goto __pyx_L12_unpacking_failed;
4235  __Pyx_GOTREF(item);
4236  *(temps[index]) = item;
4237  }
4238  if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_17), 11) < 0) __PYX_ERR(0, 652, __pyx_L1_error)
4239  __pyx_t_7 = NULL;
4240  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4241  goto __pyx_L13_unpacking_done;
4242  __pyx_L12_unpacking_failed:;
4243  __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
4244  __pyx_t_7 = NULL;
4245  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
4246  __PYX_ERR(0, 652, __pyx_L1_error)
4247  __pyx_L13_unpacking_done:;
4248  }
4249 
4250  /* "imate/traceinv/_hutchinson_method.pyx":652
4251  *
4252  * elif data_type_name == b'float64':
4253  * trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
4254  * num_processed_samples, num_samples_used, converged, \
4255  * tot_wall_time, alg_wall_time, cpu_proc_time = \
4256  */
4257  __Pyx_TraceLine(652,0,__PYX_ERR(0, 652, __pyx_L1_error))
4258  __pyx_v_trace = __pyx_t_16;
4259  __pyx_t_16 = 0;
4260  __pyx_v_error = __pyx_t_14;
4261  __pyx_t_14 = 0;
4262  __pyx_v_num_outliers = __pyx_t_15;
4263  __pyx_t_15 = 0;
4264  __pyx_v_samples = __pyx_t_13;
4265  __pyx_t_13 = 0;
4266  __pyx_v_processed_samples_indices = __pyx_t_12;
4267  __pyx_t_12 = 0;
4268  __pyx_v_num_processed_samples = __pyx_t_11;
4269  __pyx_t_11 = 0;
4270  __pyx_v_num_samples_used = __pyx_t_10;
4271  __pyx_t_10 = 0;
4272  __pyx_v_converged = __pyx_t_6;
4273  __pyx_t_6 = 0;
4274  __pyx_v_tot_wall_time = __pyx_t_3;
4275  __pyx_t_3 = 0;
4276  __pyx_v_alg_wall_time = __pyx_t_2;
4277  __pyx_t_2 = 0;
4278  __pyx_v_cpu_proc_time = __pyx_t_5;
4279  __pyx_t_5 = 0;
4280 
4281  /* "imate/traceinv/_hutchinson_method.pyx":651
4282  * num_threads)
4283  *
4284  * elif data_type_name == b'float64': # <<<<<<<<<<<<<<
4285  * trace, error, num_outliers, samples, processed_samples_indices, \
4286  * num_processed_samples, num_samples_used, converged, \
4287  */
4288  goto __pyx_L9;
4289  }
4290 
4291  /* "imate/traceinv/_hutchinson_method.pyx":663
4292  * num_threads)
4293  * else:
4294  * raise TypeError('Data type should be either "float32" or "float64"') # <<<<<<<<<<<<<<
4295  *
4296  * # Dictionary of output info
4297  */
4298  __Pyx_TraceLine(663,0,__PYX_ERR(0, 663, __pyx_L1_error))
4299  /*else*/ {
4300  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 663, __pyx_L1_error)
4301  __Pyx_GOTREF(__pyx_t_1);
4302  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
4303  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4304  __PYX_ERR(0, 663, __pyx_L1_error)
4305  }
4306  __pyx_L9:;
4307 
4308  /* "imate/traceinv/_hutchinson_method.pyx":667
4309  * # Dictionary of output info
4310  * info = {
4311  * 'matrix': # <<<<<<<<<<<<<<
4312  * {
4313  * 'data_type': data_type_name,
4314  */
4315  __Pyx_TraceLine(667,0,__PYX_ERR(0, 667, __pyx_L1_error))
4316  __pyx_t_1 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 667, __pyx_L1_error)
4317  __Pyx_GOTREF(__pyx_t_1);
4318 
4319  /* "imate/traceinv/_hutchinson_method.pyx":669
4320  * 'matrix':
4321  * {
4322  * 'data_type': data_type_name, # <<<<<<<<<<<<<<
4323  * 'gram': gram,
4324  * 'exponent': p,
4325  */
4326  __Pyx_TraceLine(669,0,__PYX_ERR(0, 669, __pyx_L1_error))
4327  __pyx_t_5 = __Pyx_PyDict_NewPresized(9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 669, __pyx_L1_error)
4328  __Pyx_GOTREF(__pyx_t_5);
4329  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_data_type, __pyx_v_data_type_name) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4330 
4331  /* "imate/traceinv/_hutchinson_method.pyx":670
4332  * {
4333  * 'data_type': data_type_name,
4334  * 'gram': gram, # <<<<<<<<<<<<<<
4335  * 'exponent': p,
4336  * 'assume_matrix': assume_matrix,
4337  */
4338  __Pyx_TraceLine(670,0,__PYX_ERR(0, 670, __pyx_L1_error))
4339  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_gram, __pyx_v_gram) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4340 
4341  /* "imate/traceinv/_hutchinson_method.pyx":671
4342  * 'data_type': data_type_name,
4343  * 'gram': gram,
4344  * 'exponent': p, # <<<<<<<<<<<<<<
4345  * 'assume_matrix': assume_matrix,
4346  * 'size': A.shape,
4347  */
4348  __Pyx_TraceLine(671,0,__PYX_ERR(0, 671, __pyx_L1_error))
4349  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_exponent, __pyx_v_p) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4350 
4351  /* "imate/traceinv/_hutchinson_method.pyx":672
4352  * 'gram': gram,
4353  * 'exponent': p,
4354  * 'assume_matrix': assume_matrix, # <<<<<<<<<<<<<<
4355  * 'size': A.shape,
4356  * 'sparse': isspmatrix(A),
4357  */
4358  __Pyx_TraceLine(672,0,__PYX_ERR(0, 672, __pyx_L1_error))
4359  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_assume_matrix, __pyx_v_assume_matrix) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4360 
4361  /* "imate/traceinv/_hutchinson_method.pyx":673
4362  * 'exponent': p,
4363  * 'assume_matrix': assume_matrix,
4364  * 'size': A.shape, # <<<<<<<<<<<<<<
4365  * 'sparse': isspmatrix(A),
4366  * 'nnz': get_nnz(A),
4367  */
4368  __Pyx_TraceLine(673,0,__PYX_ERR(0, 673, __pyx_L1_error))
4369  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 673, __pyx_L1_error)
4370  __Pyx_GOTREF(__pyx_t_2);
4371  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_size, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4372  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4373 
4374  /* "imate/traceinv/_hutchinson_method.pyx":674
4375  * 'assume_matrix': assume_matrix,
4376  * 'size': A.shape,
4377  * 'sparse': isspmatrix(A), # <<<<<<<<<<<<<<
4378  * 'nnz': get_nnz(A),
4379  * 'density': get_density(A),
4380  */
4381  __Pyx_TraceLine(674,0,__PYX_ERR(0, 674, __pyx_L1_error))
4382  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_isspmatrix); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 674, __pyx_L1_error)
4383  __Pyx_GOTREF(__pyx_t_3);
4384  __pyx_t_6 = NULL;
4385  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4386  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4387  if (likely(__pyx_t_6)) {
4388  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4389  __Pyx_INCREF(__pyx_t_6);
4390  __Pyx_INCREF(function);
4391  __Pyx_DECREF_SET(__pyx_t_3, function);
4392  }
4393  }
4394  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4395  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4396  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 674, __pyx_L1_error)
4397  __Pyx_GOTREF(__pyx_t_2);
4398  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4399  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_sparse, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4400  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4401 
4402  /* "imate/traceinv/_hutchinson_method.pyx":675
4403  * 'size': A.shape,
4404  * 'sparse': isspmatrix(A),
4405  * 'nnz': get_nnz(A), # <<<<<<<<<<<<<<
4406  * 'density': get_density(A),
4407  * 'num_inquiries': 1
4408  */
4409  __Pyx_TraceLine(675,0,__PYX_ERR(0, 675, __pyx_L1_error))
4410  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_nnz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 675, __pyx_L1_error)
4411  __Pyx_GOTREF(__pyx_t_3);
4412  __pyx_t_6 = NULL;
4413  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4414  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4415  if (likely(__pyx_t_6)) {
4416  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4417  __Pyx_INCREF(__pyx_t_6);
4418  __Pyx_INCREF(function);
4419  __Pyx_DECREF_SET(__pyx_t_3, function);
4420  }
4421  }
4422  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4423  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4424  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 675, __pyx_L1_error)
4425  __Pyx_GOTREF(__pyx_t_2);
4426  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4427  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_nnz, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4428  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4429 
4430  /* "imate/traceinv/_hutchinson_method.pyx":676
4431  * 'sparse': isspmatrix(A),
4432  * 'nnz': get_nnz(A),
4433  * 'density': get_density(A), # <<<<<<<<<<<<<<
4434  * 'num_inquiries': 1
4435  * },
4436  */
4437  __Pyx_TraceLine(676,0,__PYX_ERR(0, 676, __pyx_L1_error))
4438  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_get_density); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 676, __pyx_L1_error)
4439  __Pyx_GOTREF(__pyx_t_3);
4440  __pyx_t_6 = NULL;
4441  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
4442  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
4443  if (likely(__pyx_t_6)) {
4444  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
4445  __Pyx_INCREF(__pyx_t_6);
4446  __Pyx_INCREF(function);
4447  __Pyx_DECREF_SET(__pyx_t_3, function);
4448  }
4449  }
4450  __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_v_A) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_A);
4451  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4452  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 676, __pyx_L1_error)
4453  __Pyx_GOTREF(__pyx_t_2);
4454  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4455  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_density, __pyx_t_2) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4456  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4457  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_inquiries, __pyx_int_1) < 0) __PYX_ERR(0, 669, __pyx_L1_error)
4458  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_matrix, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4459  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4460 
4461  /* "imate/traceinv/_hutchinson_method.pyx":681
4462  * 'error':
4463  * {
4464  * 'absolute_error': error, # <<<<<<<<<<<<<<
4465  * 'relative_error': \
4466  * error / (numpy.abs(trace) + numpy.finfo(float).eps),
4467  */
4468  __Pyx_TraceLine(681,0,__PYX_ERR(0, 681, __pyx_L1_error))
4469  __pyx_t_5 = __Pyx_PyDict_NewPresized(6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 681, __pyx_L1_error)
4470  __Pyx_GOTREF(__pyx_t_5);
4471  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_absolute_error, __pyx_v_error) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4472 
4473  /* "imate/traceinv/_hutchinson_method.pyx":683
4474  * 'absolute_error': error,
4475  * 'relative_error': \
4476  * error / (numpy.abs(trace) + numpy.finfo(float).eps), # <<<<<<<<<<<<<<
4477  * 'error_atol': error_atol,
4478  * 'error_rtol': error_rtol,
4479  */
4480  __Pyx_TraceLine(683,0,__PYX_ERR(0, 683, __pyx_L1_error))
4481  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
4482  __Pyx_GOTREF(__pyx_t_3);
4483  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_abs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4484  __Pyx_GOTREF(__pyx_t_6);
4485  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4486  __pyx_t_3 = NULL;
4487  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
4488  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6);
4489  if (likely(__pyx_t_3)) {
4490  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
4491  __Pyx_INCREF(__pyx_t_3);
4492  __Pyx_INCREF(function);
4493  __Pyx_DECREF_SET(__pyx_t_6, function);
4494  }
4495  }
4496  __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_3, __pyx_v_trace) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_trace);
4497  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4498  if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 683, __pyx_L1_error)
4499  __Pyx_GOTREF(__pyx_t_2);
4500  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4501  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_numpy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 683, __pyx_L1_error)
4502  __Pyx_GOTREF(__pyx_t_3);
4503  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_finfo); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4504  __Pyx_GOTREF(__pyx_t_10);
4505  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4506  __pyx_t_3 = NULL;
4507  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
4508  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_10);
4509  if (likely(__pyx_t_3)) {
4510  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4511  __Pyx_INCREF(__pyx_t_3);
4512  __Pyx_INCREF(function);
4513  __Pyx_DECREF_SET(__pyx_t_10, function);
4514  }
4515  }
4516  __pyx_t_6 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_10, __pyx_t_3, ((PyObject *)(&PyFloat_Type))) : __Pyx_PyObject_CallOneArg(__pyx_t_10, ((PyObject *)(&PyFloat_Type)));
4517  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
4518  if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4519  __Pyx_GOTREF(__pyx_t_6);
4520  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4521  __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_eps); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4522  __Pyx_GOTREF(__pyx_t_10);
4523  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4524  __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 683, __pyx_L1_error)
4525  __Pyx_GOTREF(__pyx_t_6);
4526  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4527  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4528  __pyx_t_10 = __Pyx_PyNumber_Divide(__pyx_v_error, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 683, __pyx_L1_error)
4529  __Pyx_GOTREF(__pyx_t_10);
4530  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4531  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_relative_error, __pyx_t_10) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4532  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4533 
4534  /* "imate/traceinv/_hutchinson_method.pyx":684
4535  * 'relative_error': \
4536  * error / (numpy.abs(trace) + numpy.finfo(float).eps),
4537  * 'error_atol': error_atol, # <<<<<<<<<<<<<<
4538  * 'error_rtol': error_rtol,
4539  * 'confidence_level': confidence_level,
4540  */
4541  __Pyx_TraceLine(684,0,__PYX_ERR(0, 684, __pyx_L1_error))
4542  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_error_atol, __pyx_v_error_atol) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4543 
4544  /* "imate/traceinv/_hutchinson_method.pyx":685
4545  * error / (numpy.abs(trace) + numpy.finfo(float).eps),
4546  * 'error_atol': error_atol,
4547  * 'error_rtol': error_rtol, # <<<<<<<<<<<<<<
4548  * 'confidence_level': confidence_level,
4549  * 'outlier_significance_level': outlier_significance_level
4550  */
4551  __Pyx_TraceLine(685,0,__PYX_ERR(0, 685, __pyx_L1_error))
4552  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_error_rtol, __pyx_v_error_rtol) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4553 
4554  /* "imate/traceinv/_hutchinson_method.pyx":686
4555  * 'error_atol': error_atol,
4556  * 'error_rtol': error_rtol,
4557  * 'confidence_level': confidence_level, # <<<<<<<<<<<<<<
4558  * 'outlier_significance_level': outlier_significance_level
4559  * },
4560  */
4561  __Pyx_TraceLine(686,0,__PYX_ERR(0, 686, __pyx_L1_error))
4562  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_confidence_level, __pyx_v_confidence_level) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4563 
4564  /* "imate/traceinv/_hutchinson_method.pyx":687
4565  * 'error_rtol': error_rtol,
4566  * 'confidence_level': confidence_level,
4567  * 'outlier_significance_level': outlier_significance_level # <<<<<<<<<<<<<<
4568  * },
4569  * 'convergence':
4570  */
4571  __Pyx_TraceLine(687,0,__PYX_ERR(0, 687, __pyx_L1_error))
4572  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_outlier_significance_level, __pyx_v_outlier_significance_level) < 0) __PYX_ERR(0, 681, __pyx_L1_error)
4573  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_error, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4574  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4575 
4576  /* "imate/traceinv/_hutchinson_method.pyx":691
4577  * 'convergence':
4578  * {
4579  * 'converged': bool(converged), # <<<<<<<<<<<<<<
4580  * 'min_num_samples': min_num_samples,
4581  * 'max_num_samples': max_num_samples,
4582  */
4583  __Pyx_TraceLine(691,0,__PYX_ERR(0, 691, __pyx_L1_error))
4584  __pyx_t_5 = __Pyx_PyDict_NewPresized(8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 691, __pyx_L1_error)
4585  __Pyx_GOTREF(__pyx_t_5);
4586  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_converged); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 691, __pyx_L1_error)
4587  __pyx_t_10 = __Pyx_PyBool_FromLong((!(!__pyx_t_9))); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 691, __pyx_L1_error)
4588  __Pyx_GOTREF(__pyx_t_10);
4589  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_converged, __pyx_t_10) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4590  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4591 
4592  /* "imate/traceinv/_hutchinson_method.pyx":692
4593  * {
4594  * 'converged': bool(converged),
4595  * 'min_num_samples': min_num_samples, # <<<<<<<<<<<<<<
4596  * 'max_num_samples': max_num_samples,
4597  * 'num_samples_used': num_samples_used,
4598  */
4599  __Pyx_TraceLine(692,0,__PYX_ERR(0, 692, __pyx_L1_error))
4600  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_min_num_samples, __pyx_v_min_num_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4601 
4602  /* "imate/traceinv/_hutchinson_method.pyx":693
4603  * 'converged': bool(converged),
4604  * 'min_num_samples': min_num_samples,
4605  * 'max_num_samples': max_num_samples, # <<<<<<<<<<<<<<
4606  * 'num_samples_used': num_samples_used,
4607  * 'num_outliers': num_outliers,
4608  */
4609  __Pyx_TraceLine(693,0,__PYX_ERR(0, 693, __pyx_L1_error))
4610  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_max_num_samples, __pyx_v_max_num_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4611 
4612  /* "imate/traceinv/_hutchinson_method.pyx":694
4613  * 'min_num_samples': min_num_samples,
4614  * 'max_num_samples': max_num_samples,
4615  * 'num_samples_used': num_samples_used, # <<<<<<<<<<<<<<
4616  * 'num_outliers': num_outliers,
4617  * 'samples': samples,
4618  */
4619  __Pyx_TraceLine(694,0,__PYX_ERR(0, 694, __pyx_L1_error))
4620  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_samples_used, __pyx_v_num_samples_used) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4621 
4622  /* "imate/traceinv/_hutchinson_method.pyx":695
4623  * 'max_num_samples': max_num_samples,
4624  * 'num_samples_used': num_samples_used,
4625  * 'num_outliers': num_outliers, # <<<<<<<<<<<<<<
4626  * 'samples': samples,
4627  * 'samples_mean': trace,
4628  */
4629  __Pyx_TraceLine(695,0,__PYX_ERR(0, 695, __pyx_L1_error))
4630  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_outliers, __pyx_v_num_outliers) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4631 
4632  /* "imate/traceinv/_hutchinson_method.pyx":696
4633  * 'num_samples_used': num_samples_used,
4634  * 'num_outliers': num_outliers,
4635  * 'samples': samples, # <<<<<<<<<<<<<<
4636  * 'samples_mean': trace,
4637  * 'samples_processed_order': processed_samples_indices
4638  */
4639  __Pyx_TraceLine(696,0,__PYX_ERR(0, 696, __pyx_L1_error))
4640  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples, __pyx_v_samples) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4641 
4642  /* "imate/traceinv/_hutchinson_method.pyx":697
4643  * 'num_outliers': num_outliers,
4644  * 'samples': samples,
4645  * 'samples_mean': trace, # <<<<<<<<<<<<<<
4646  * 'samples_processed_order': processed_samples_indices
4647  * },
4648  */
4649  __Pyx_TraceLine(697,0,__PYX_ERR(0, 697, __pyx_L1_error))
4650  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples_mean, __pyx_v_trace) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4651 
4652  /* "imate/traceinv/_hutchinson_method.pyx":698
4653  * 'samples': samples,
4654  * 'samples_mean': trace,
4655  * 'samples_processed_order': processed_samples_indices # <<<<<<<<<<<<<<
4656  * },
4657  * 'device':
4658  */
4659  __Pyx_TraceLine(698,0,__PYX_ERR(0, 698, __pyx_L1_error))
4660  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_samples_processed_order, __pyx_v_processed_samples_indices) < 0) __PYX_ERR(0, 691, __pyx_L1_error)
4661  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_convergence, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4662  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4663 
4664  /* "imate/traceinv/_hutchinson_method.pyx":702
4665  * 'device':
4666  * {
4667  * 'num_cpu_threads': num_threads, # <<<<<<<<<<<<<<
4668  * 'num_gpu_devices': 0,
4669  * 'num_gpu_multiprocessors': 0,
4670  */
4671  __Pyx_TraceLine(702,0,__PYX_ERR(0, 702, __pyx_L1_error))
4672  __pyx_t_5 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 702, __pyx_L1_error)
4673  __Pyx_GOTREF(__pyx_t_5);
4674  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_cpu_threads, __pyx_v_num_threads) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4675  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_devices, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4676  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_multiprocessors, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4677  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_num_gpu_threads_per_multiprocess, __pyx_int_0) < 0) __PYX_ERR(0, 702, __pyx_L1_error)
4678  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_device, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4679  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4680 
4681  /* "imate/traceinv/_hutchinson_method.pyx":709
4682  * 'time':
4683  * {
4684  * 'tot_wall_time': tot_wall_time, # <<<<<<<<<<<<<<
4685  * 'alg_wall_time': alg_wall_time,
4686  * 'cpu_proc_time': cpu_proc_time,
4687  */
4688  __Pyx_TraceLine(709,0,__PYX_ERR(0, 709, __pyx_L1_error))
4689  __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 709, __pyx_L1_error)
4690  __Pyx_GOTREF(__pyx_t_5);
4691  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_tot_wall_time, __pyx_v_tot_wall_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4692 
4693  /* "imate/traceinv/_hutchinson_method.pyx":710
4694  * {
4695  * 'tot_wall_time': tot_wall_time,
4696  * 'alg_wall_time': alg_wall_time, # <<<<<<<<<<<<<<
4697  * 'cpu_proc_time': cpu_proc_time,
4698  * },
4699  */
4700  __Pyx_TraceLine(710,0,__PYX_ERR(0, 710, __pyx_L1_error))
4701  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_alg_wall_time, __pyx_v_alg_wall_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4702 
4703  /* "imate/traceinv/_hutchinson_method.pyx":711
4704  * 'tot_wall_time': tot_wall_time,
4705  * 'alg_wall_time': alg_wall_time,
4706  * 'cpu_proc_time': cpu_proc_time, # <<<<<<<<<<<<<<
4707  * },
4708  * 'solver':
4709  */
4710  __Pyx_TraceLine(711,0,__PYX_ERR(0, 711, __pyx_L1_error))
4711  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_cpu_proc_time, __pyx_v_cpu_proc_time) < 0) __PYX_ERR(0, 709, __pyx_L1_error)
4712  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_time, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4713  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4714 
4715  /* "imate/traceinv/_hutchinson_method.pyx":715
4716  * 'solver':
4717  * {
4718  * 'version': __version__, # <<<<<<<<<<<<<<
4719  * 'orthogonalize': orthogonalize,
4720  * 'seed': seed,
4721  */
4722  __Pyx_TraceLine(715,0,__PYX_ERR(0, 715, __pyx_L1_error))
4723  __pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 715, __pyx_L1_error)
4724  __Pyx_GOTREF(__pyx_t_5);
4725  __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_version_2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 715, __pyx_L1_error)
4726  __Pyx_GOTREF(__pyx_t_10);
4727  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_version, __pyx_t_10) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4728  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4729 
4730  /* "imate/traceinv/_hutchinson_method.pyx":716
4731  * {
4732  * 'version': __version__,
4733  * 'orthogonalize': orthogonalize, # <<<<<<<<<<<<<<
4734  * 'seed': seed,
4735  * 'solver_tol': solver_tol,
4736  */
4737  __Pyx_TraceLine(716,0,__PYX_ERR(0, 716, __pyx_L1_error))
4738  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_orthogonalize, __pyx_v_orthogonalize) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4739 
4740  /* "imate/traceinv/_hutchinson_method.pyx":717
4741  * 'version': __version__,
4742  * 'orthogonalize': orthogonalize,
4743  * 'seed': seed, # <<<<<<<<<<<<<<
4744  * 'solver_tol': solver_tol,
4745  * 'method': 'hutchinson',
4746  */
4747  __Pyx_TraceLine(717,0,__PYX_ERR(0, 717, __pyx_L1_error))
4748  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_seed, __pyx_v_seed) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4749 
4750  /* "imate/traceinv/_hutchinson_method.pyx":718
4751  * 'orthogonalize': orthogonalize,
4752  * 'seed': seed,
4753  * 'solver_tol': solver_tol, # <<<<<<<<<<<<<<
4754  * 'method': 'hutchinson',
4755  * }
4756  */
4757  __Pyx_TraceLine(718,0,__PYX_ERR(0, 718, __pyx_L1_error))
4758  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_solver_tol, __pyx_v_solver_tol) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4759  if (PyDict_SetItem(__pyx_t_5, __pyx_n_u_method, __pyx_n_u_hutchinson) < 0) __PYX_ERR(0, 715, __pyx_L1_error)
4760  if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_solver, __pyx_t_5) < 0) __PYX_ERR(0, 667, __pyx_L1_error)
4761  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4762  __pyx_v_info = ((PyObject*)__pyx_t_1);
4763  __pyx_t_1 = 0;
4764 
4765  /* "imate/traceinv/_hutchinson_method.pyx":724
4766  *
4767  * # print summary
4768  * if verbose: # <<<<<<<<<<<<<<
4769  * print_summary(info)
4770  *
4771  */
4772  __Pyx_TraceLine(724,0,__PYX_ERR(0, 724, __pyx_L1_error))
4773  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_verbose); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 724, __pyx_L1_error)
4774  if (__pyx_t_9) {
4775 
4776  /* "imate/traceinv/_hutchinson_method.pyx":725
4777  * # print summary
4778  * if verbose:
4779  * print_summary(info) # <<<<<<<<<<<<<<
4780  *
4781  * # Plot results
4782  */
4783  __Pyx_TraceLine(725,0,__PYX_ERR(0, 725, __pyx_L1_error))
4784  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_print_summary); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 725, __pyx_L1_error)
4785  __Pyx_GOTREF(__pyx_t_5);
4786  __pyx_t_10 = NULL;
4787  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4788  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
4789  if (likely(__pyx_t_10)) {
4790  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4791  __Pyx_INCREF(__pyx_t_10);
4792  __Pyx_INCREF(function);
4793  __Pyx_DECREF_SET(__pyx_t_5, function);
4794  }
4795  }
4796  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_info) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_info);
4797  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4798  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 725, __pyx_L1_error)
4799  __Pyx_GOTREF(__pyx_t_1);
4800  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4801  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4802 
4803  /* "imate/traceinv/_hutchinson_method.pyx":724
4804  *
4805  * # print summary
4806  * if verbose: # <<<<<<<<<<<<<<
4807  * print_summary(info)
4808  *
4809  */
4810  }
4811 
4812  /* "imate/traceinv/_hutchinson_method.pyx":728
4813  *
4814  * # Plot results
4815  * if plot: # <<<<<<<<<<<<<<
4816  * plot_convergence(info)
4817  *
4818  */
4819  __Pyx_TraceLine(728,0,__PYX_ERR(0, 728, __pyx_L1_error))
4820  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_plot); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 728, __pyx_L1_error)
4821  if (__pyx_t_9) {
4822 
4823  /* "imate/traceinv/_hutchinson_method.pyx":729
4824  * # Plot results
4825  * if plot:
4826  * plot_convergence(info) # <<<<<<<<<<<<<<
4827  *
4828  * if return_info:
4829  */
4830  __Pyx_TraceLine(729,0,__PYX_ERR(0, 729, __pyx_L1_error))
4831  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_plot_convergence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 729, __pyx_L1_error)
4832  __Pyx_GOTREF(__pyx_t_5);
4833  __pyx_t_10 = NULL;
4834  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4835  __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_5);
4836  if (likely(__pyx_t_10)) {
4837  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4838  __Pyx_INCREF(__pyx_t_10);
4839  __Pyx_INCREF(function);
4840  __Pyx_DECREF_SET(__pyx_t_5, function);
4841  }
4842  }
4843  __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_10, __pyx_v_info) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_info);
4844  __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4845  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 729, __pyx_L1_error)
4846  __Pyx_GOTREF(__pyx_t_1);
4847  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4848  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4849 
4850  /* "imate/traceinv/_hutchinson_method.pyx":728
4851  *
4852  * # Plot results
4853  * if plot: # <<<<<<<<<<<<<<
4854  * plot_convergence(info)
4855  *
4856  */
4857  }
4858 
4859  /* "imate/traceinv/_hutchinson_method.pyx":731
4860  * plot_convergence(info)
4861  *
4862  * if return_info: # <<<<<<<<<<<<<<
4863  * return trace, info
4864  * else:
4865  */
4866  __Pyx_TraceLine(731,0,__PYX_ERR(0, 731, __pyx_L1_error))
4867  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_return_info); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 731, __pyx_L1_error)
4868  if (__pyx_t_9) {
4869 
4870  /* "imate/traceinv/_hutchinson_method.pyx":732
4871  *
4872  * if return_info:
4873  * return trace, info # <<<<<<<<<<<<<<
4874  * else:
4875  * return trace
4876  */
4877  __Pyx_TraceLine(732,0,__PYX_ERR(0, 732, __pyx_L1_error))
4878  __Pyx_XDECREF(__pyx_r);
4879  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 732, __pyx_L1_error)
4880  __Pyx_GOTREF(__pyx_t_1);
4881  __Pyx_INCREF(__pyx_v_trace);
4882  __Pyx_GIVEREF(__pyx_v_trace);
4883  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_trace);
4884  __Pyx_INCREF(__pyx_v_info);
4885  __Pyx_GIVEREF(__pyx_v_info);
4886  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_info);
4887  __pyx_r = __pyx_t_1;
4888  __pyx_t_1 = 0;
4889  goto __pyx_L0;
4890 
4891  /* "imate/traceinv/_hutchinson_method.pyx":731
4892  * plot_convergence(info)
4893  *
4894  * if return_info: # <<<<<<<<<<<<<<
4895  * return trace, info
4896  * else:
4897  */
4898  }
4899 
4900  /* "imate/traceinv/_hutchinson_method.pyx":734
4901  * return trace, info
4902  * else:
4903  * return trace # <<<<<<<<<<<<<<
4904  *
4905  *
4906  */
4907  __Pyx_TraceLine(734,0,__PYX_ERR(0, 734, __pyx_L1_error))
4908  /*else*/ {
4909  __Pyx_XDECREF(__pyx_r);
4910  __Pyx_INCREF(__pyx_v_trace);
4911  __pyx_r = __pyx_v_trace;
4912  goto __pyx_L0;
4913  }
4914 
4915  /* "imate/traceinv/_hutchinson_method.pyx":37
4916  * # =================
4917  *
4918  * def hutchinson_method( # <<<<<<<<<<<<<<
4919  * A,
4920  * gram=False,
4921  */
4922 
4923  /* function exit code */
4924  __pyx_L1_error:;
4925  __Pyx_XDECREF(__pyx_t_1);
4926  __Pyx_XDECREF(__pyx_t_2);
4927  __Pyx_XDECREF(__pyx_t_3);
4928  __Pyx_XDECREF(__pyx_t_5);
4929  __Pyx_XDECREF(__pyx_t_6);
4930  __Pyx_XDECREF(__pyx_t_10);
4931  __Pyx_XDECREF(__pyx_t_11);
4932  __Pyx_XDECREF(__pyx_t_12);
4933  __Pyx_XDECREF(__pyx_t_13);
4934  __Pyx_XDECREF(__pyx_t_14);
4935  __Pyx_XDECREF(__pyx_t_15);
4936  __Pyx_XDECREF(__pyx_t_16);
4937  __Pyx_XDECREF(__pyx_t_17);
4938  __Pyx_AddTraceback("imate.traceinv._hutchinson_method.hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
4939  __pyx_r = NULL;
4940  __pyx_L0:;
4941  __Pyx_XDECREF(__pyx_v_square);
4942  __Pyx_XDECREF(__pyx_v_data_type_name);
4943  __Pyx_XDECREF(__pyx_v_trace);
4944  __Pyx_XDECREF(__pyx_v_error);
4945  __Pyx_XDECREF(__pyx_v_num_outliers);
4946  __Pyx_XDECREF(__pyx_v_samples);
4947  __Pyx_XDECREF(__pyx_v_processed_samples_indices);
4948  __Pyx_XDECREF(__pyx_v_num_processed_samples);
4949  __Pyx_XDECREF(__pyx_v_num_samples_used);
4950  __Pyx_XDECREF(__pyx_v_converged);
4951  __Pyx_XDECREF(__pyx_v_tot_wall_time);
4952  __Pyx_XDECREF(__pyx_v_alg_wall_time);
4953  __Pyx_XDECREF(__pyx_v_cpu_proc_time);
4954  __Pyx_XDECREF(__pyx_v_info);
4955  __Pyx_XDECREF(__pyx_v_min_num_samples);
4956  __Pyx_XDECREF(__pyx_v_max_num_samples);
4957  __Pyx_XDECREF(__pyx_v_error_atol);
4958  __Pyx_XDECREF(__pyx_v_error_rtol);
4959  __Pyx_XDECREF(__pyx_v_seed);
4960  __Pyx_XDECREF(__pyx_v_num_threads);
4961  __Pyx_XGIVEREF(__pyx_r);
4962  __Pyx_TraceReturn(__pyx_r, 0);
4963  __Pyx_RefNannyFinishContext();
4964  return __pyx_r;
4965 }
4966 
4967 /* "imate/traceinv/_hutchinson_method.pyx":741
4968  * # =======================
4969  *
4970  * def _hutchinson_method_float( # <<<<<<<<<<<<<<
4971  * A,
4972  * B,
4973  */
4974 
4975 /* Python wrapper */
4976 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4977 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float[] = "_hutchinson_method_float(A, B, C, gram, p, assume_matrix, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, solver_tol, orthogonalize, seed, num_threads)\n\n This method processes single precision (32-bit) matrix ``A``.\n ";
4978 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float = {"_hutchinson_method_float", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float};
4979 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4980  PyObject *__pyx_v_A = 0;
4981  PyObject *__pyx_v_B = 0;
4982  PyObject *__pyx_v_C = 0;
4983  PyObject *__pyx_v_gram = 0;
4984  PyObject *__pyx_v_p = 0;
4985  PyObject *__pyx_v_assume_matrix = 0;
4986  PyObject *__pyx_v_min_num_samples = 0;
4987  PyObject *__pyx_v_max_num_samples = 0;
4988  PyObject *__pyx_v_error_atol = 0;
4989  PyObject *__pyx_v_error_rtol = 0;
4990  PyObject *__pyx_v_confidence_level = 0;
4991  PyObject *__pyx_v_outlier_significance_level = 0;
4992  PyObject *__pyx_v_solver_tol = 0;
4993  PyObject *__pyx_v_orthogonalize = 0;
4994  PyObject *__pyx_v_seed = 0;
4995  PyObject *__pyx_v_num_threads = 0;
4996  int __pyx_lineno = 0;
4997  const char *__pyx_filename = NULL;
4998  int __pyx_clineno = 0;
4999  PyObject *__pyx_r = 0;
5000  __Pyx_RefNannyDeclarations
5001  __Pyx_RefNannySetupContext("_hutchinson_method_float (wrapper)", 0);
5002  {
5003  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,0};
5004  PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
5005  if (unlikely(__pyx_kwds)) {
5006  Py_ssize_t kw_args;
5007  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5008  switch (pos_args) {
5009  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
5010  CYTHON_FALLTHROUGH;
5011  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
5012  CYTHON_FALLTHROUGH;
5013  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
5014  CYTHON_FALLTHROUGH;
5015  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
5016  CYTHON_FALLTHROUGH;
5017  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
5018  CYTHON_FALLTHROUGH;
5019  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
5020  CYTHON_FALLTHROUGH;
5021  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
5022  CYTHON_FALLTHROUGH;
5023  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5024  CYTHON_FALLTHROUGH;
5025  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5026  CYTHON_FALLTHROUGH;
5027  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5028  CYTHON_FALLTHROUGH;
5029  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5030  CYTHON_FALLTHROUGH;
5031  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5032  CYTHON_FALLTHROUGH;
5033  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5034  CYTHON_FALLTHROUGH;
5035  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5036  CYTHON_FALLTHROUGH;
5037  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5038  CYTHON_FALLTHROUGH;
5039  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5040  CYTHON_FALLTHROUGH;
5041  case 0: break;
5042  default: goto __pyx_L5_argtuple_error;
5043  }
5044  kw_args = PyDict_Size(__pyx_kwds);
5045  switch (pos_args) {
5046  case 0:
5047  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5048  else goto __pyx_L5_argtuple_error;
5049  CYTHON_FALLTHROUGH;
5050  case 1:
5051  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
5052  else {
5053  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 1); __PYX_ERR(0, 741, __pyx_L3_error)
5054  }
5055  CYTHON_FALLTHROUGH;
5056  case 2:
5057  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
5058  else {
5059  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 2); __PYX_ERR(0, 741, __pyx_L3_error)
5060  }
5061  CYTHON_FALLTHROUGH;
5062  case 3:
5063  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
5064  else {
5065  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 3); __PYX_ERR(0, 741, __pyx_L3_error)
5066  }
5067  CYTHON_FALLTHROUGH;
5068  case 4:
5069  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
5070  else {
5071  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 4); __PYX_ERR(0, 741, __pyx_L3_error)
5072  }
5073  CYTHON_FALLTHROUGH;
5074  case 5:
5075  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
5076  else {
5077  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 5); __PYX_ERR(0, 741, __pyx_L3_error)
5078  }
5079  CYTHON_FALLTHROUGH;
5080  case 6:
5081  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
5082  else {
5083  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 6); __PYX_ERR(0, 741, __pyx_L3_error)
5084  }
5085  CYTHON_FALLTHROUGH;
5086  case 7:
5087  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
5088  else {
5089  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 7); __PYX_ERR(0, 741, __pyx_L3_error)
5090  }
5091  CYTHON_FALLTHROUGH;
5092  case 8:
5093  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
5094  else {
5095  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 8); __PYX_ERR(0, 741, __pyx_L3_error)
5096  }
5097  CYTHON_FALLTHROUGH;
5098  case 9:
5099  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
5100  else {
5101  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 9); __PYX_ERR(0, 741, __pyx_L3_error)
5102  }
5103  CYTHON_FALLTHROUGH;
5104  case 10:
5105  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
5106  else {
5107  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 10); __PYX_ERR(0, 741, __pyx_L3_error)
5108  }
5109  CYTHON_FALLTHROUGH;
5110  case 11:
5111  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
5112  else {
5113  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 11); __PYX_ERR(0, 741, __pyx_L3_error)
5114  }
5115  CYTHON_FALLTHROUGH;
5116  case 12:
5117  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
5118  else {
5119  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 12); __PYX_ERR(0, 741, __pyx_L3_error)
5120  }
5121  CYTHON_FALLTHROUGH;
5122  case 13:
5123  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize)) != 0)) kw_args--;
5124  else {
5125  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 13); __PYX_ERR(0, 741, __pyx_L3_error)
5126  }
5127  CYTHON_FALLTHROUGH;
5128  case 14:
5129  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
5130  else {
5131  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 14); __PYX_ERR(0, 741, __pyx_L3_error)
5132  }
5133  CYTHON_FALLTHROUGH;
5134  case 15:
5135  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
5136  else {
5137  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, 15); __PYX_ERR(0, 741, __pyx_L3_error)
5138  }
5139  }
5140  if (unlikely(kw_args > 0)) {
5141  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_hutchinson_method_float") < 0)) __PYX_ERR(0, 741, __pyx_L3_error)
5142  }
5143  } else if (PyTuple_GET_SIZE(__pyx_args) != 16) {
5144  goto __pyx_L5_argtuple_error;
5145  } else {
5146  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5147  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5148  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5149  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5150  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5151  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5152  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
5153  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
5154  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
5155  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
5156  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
5157  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
5158  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
5159  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
5160  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
5161  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
5162  }
5163  __pyx_v_A = values[0];
5164  __pyx_v_B = values[1];
5165  __pyx_v_C = values[2];
5166  __pyx_v_gram = values[3];
5167  __pyx_v_p = values[4];
5168  __pyx_v_assume_matrix = values[5];
5169  __pyx_v_min_num_samples = values[6];
5170  __pyx_v_max_num_samples = values[7];
5171  __pyx_v_error_atol = values[8];
5172  __pyx_v_error_rtol = values[9];
5173  __pyx_v_confidence_level = values[10];
5174  __pyx_v_outlier_significance_level = values[11];
5175  __pyx_v_solver_tol = values[12];
5176  __pyx_v_orthogonalize = values[13];
5177  __pyx_v_seed = values[14];
5178  __pyx_v_num_threads = values[15];
5179  }
5180  goto __pyx_L4_argument_unpacking_done;
5181  __pyx_L5_argtuple_error:;
5182  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_float", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 741, __pyx_L3_error)
5183  __pyx_L3_error:;
5184  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._hutchinson_method_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
5185  __Pyx_RefNannyFinishContext();
5186  return NULL;
5187  __pyx_L4_argument_unpacking_done:;
5188  __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads);
5189 
5190  /* function exit code */
5191  __Pyx_RefNannyFinishContext();
5192  return __pyx_r;
5193 }
5194 
5195 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_2_hutchinson_method_float(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads) {
5196  PyObject *__pyx_v_vector_size = NULL;
5197  PyObject *__pyx_v_E = NULL;
5198  __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
5199  float *__pyx_v_cE;
5200  PyObject *__pyx_v_init_tot_wall_time = NULL;
5201  PyObject *__pyx_v_init_cpu_proc_time = NULL;
5202  PyObject *__pyx_v_samples = NULL;
5203  PyObject *__pyx_v_processed_samples_indices = NULL;
5204  int __pyx_v_num_processed_samples;
5205  int __pyx_v_num_samples_used;
5206  int __pyx_v_converged;
5207  PyObject *__pyx_v_init_alg_wall_time = NULL;
5208  PyObject *__pyx_v_AtA = NULL;
5209  PyObject *__pyx_v_i = NULL;
5210  PyObject *__pyx_v_alg_wall_time = NULL;
5211  PyObject *__pyx_v_trace = NULL;
5212  PyObject *__pyx_v_error = NULL;
5213  PyObject *__pyx_v_num_outliers = NULL;
5214  PyObject *__pyx_v_tot_wall_time = NULL;
5215  PyObject *__pyx_v_cpu_proc_time = NULL;
5216  PyObject *__pyx_r = NULL;
5217  __Pyx_TraceDeclarations
5218  __Pyx_RefNannyDeclarations
5219  PyObject *__pyx_t_1 = NULL;
5220  PyObject *__pyx_t_2 = NULL;
5221  PyObject *__pyx_t_3 = NULL;
5222  PyObject *__pyx_t_4 = NULL;
5223  PyObject *__pyx_t_5 = NULL;
5224  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5225  Py_ssize_t __pyx_t_7;
5226  Py_ssize_t __pyx_t_8;
5227  LongIndexType __pyx_t_9;
5228  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5229  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5230  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5231  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5232  int __pyx_t_14;
5233  int __pyx_t_15;
5234  int __pyx_t_16;
5235  Py_ssize_t __pyx_t_17;
5236  PyObject *(*__pyx_t_18)(PyObject *);
5237  float __pyx_t_19;
5238  int __pyx_t_20;
5239  PyObject *__pyx_t_21 = NULL;
5240  PyObject *(*__pyx_t_22)(PyObject *);
5241  int __pyx_t_23;
5242  int __pyx_lineno = 0;
5243  const char *__pyx_filename = NULL;
5244  int __pyx_clineno = 0;
5245  __Pyx_TraceFrameInit(__pyx_codeobj__3)
5246  __Pyx_RefNannySetupContext("_hutchinson_method_float", 0);
5247  __Pyx_TraceCall("_hutchinson_method_float", __pyx_f[0], 741, 0, __PYX_ERR(0, 741, __pyx_L1_error));
5248 
5249  /* "imate/traceinv/_hutchinson_method.pyx":762
5250  * """
5251  *
5252  * vector_size = A.shape[0] # <<<<<<<<<<<<<<
5253  *
5254  * # Allocate random array with Fortran ordering (first index is contiguous)
5255  */
5256  __Pyx_TraceLine(762,0,__PYX_ERR(0, 762, __pyx_L1_error))
5257  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 762, __pyx_L1_error)
5258  __Pyx_GOTREF(__pyx_t_1);
5259  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 762, __pyx_L1_error)
5260  __Pyx_GOTREF(__pyx_t_2);
5261  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5262  __pyx_v_vector_size = __pyx_t_2;
5263  __pyx_t_2 = 0;
5264 
5265  /* "imate/traceinv/_hutchinson_method.pyx":766
5266  * # Allocate random array with Fortran ordering (first index is contiguous)
5267  * # 2D array E should be treated as a matrix, random vectors are columns of E
5268  * E = numpy.empty((vector_size, max_num_samples), dtype=numpy.float32, # <<<<<<<<<<<<<<
5269  * order='F')
5270  *
5271  */
5272  __Pyx_TraceLine(766,0,__PYX_ERR(0, 766, __pyx_L1_error))
5273  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5274  __Pyx_GOTREF(__pyx_t_2);
5275  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 766, __pyx_L1_error)
5276  __Pyx_GOTREF(__pyx_t_1);
5277  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5278  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5279  __Pyx_GOTREF(__pyx_t_2);
5280  __Pyx_INCREF(__pyx_v_vector_size);
5281  __Pyx_GIVEREF(__pyx_v_vector_size);
5282  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_vector_size);
5283  __Pyx_INCREF(__pyx_v_max_num_samples);
5284  __Pyx_GIVEREF(__pyx_v_max_num_samples);
5285  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_max_num_samples);
5286  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L1_error)
5287  __Pyx_GOTREF(__pyx_t_3);
5288  __Pyx_GIVEREF(__pyx_t_2);
5289  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
5290  __pyx_t_2 = 0;
5291  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error)
5292  __Pyx_GOTREF(__pyx_t_2);
5293  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 766, __pyx_L1_error)
5294  __Pyx_GOTREF(__pyx_t_4);
5295  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float32); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L1_error)
5296  __Pyx_GOTREF(__pyx_t_5);
5297  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5298  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
5299  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5300  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_u_F) < 0) __PYX_ERR(0, 766, __pyx_L1_error)
5301  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 766, __pyx_L1_error)
5302  __Pyx_GOTREF(__pyx_t_5);
5303  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5304  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5305  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5306  __pyx_v_E = __pyx_t_5;
5307  __pyx_t_5 = 0;
5308 
5309  /* "imate/traceinv/_hutchinson_method.pyx":770
5310  *
5311  * # Get c pointer to E
5312  * cdef float[::1, :] memoryview_E = E # <<<<<<<<<<<<<<
5313  * cdef float* cE = &memoryview_E[0, 0]
5314  *
5315  */
5316  __Pyx_TraceLine(770,0,__PYX_ERR(0, 770, __pyx_L1_error))
5317  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dcd__float(__pyx_v_E, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 770, __pyx_L1_error)
5318  __pyx_v_memoryview_E = __pyx_t_6;
5319  __pyx_t_6.memview = NULL;
5320  __pyx_t_6.data = NULL;
5321 
5322  /* "imate/traceinv/_hutchinson_method.pyx":771
5323  * # Get c pointer to E
5324  * cdef float[::1, :] memoryview_E = E
5325  * cdef float* cE = &memoryview_E[0, 0] # <<<<<<<<<<<<<<
5326  *
5327  * init_tot_wall_time = time.perf_counter()
5328  */
5329  __Pyx_TraceLine(771,0,__PYX_ERR(0, 771, __pyx_L1_error))
5330  __pyx_t_7 = 0;
5331  __pyx_t_8 = 0;
5332  __pyx_v_cE = (&(*((float *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((float *) __pyx_v_memoryview_E.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_memoryview_E.strides[1]) ))));
5333 
5334  /* "imate/traceinv/_hutchinson_method.pyx":773
5335  * cdef float* cE = &memoryview_E[0, 0]
5336  *
5337  * init_tot_wall_time = time.perf_counter() # <<<<<<<<<<<<<<
5338  * init_cpu_proc_time = time.process_time()
5339  *
5340  */
5341  __Pyx_TraceLine(773,0,__PYX_ERR(0, 773, __pyx_L1_error))
5342  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error)
5343  __Pyx_GOTREF(__pyx_t_2);
5344  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error)
5345  __Pyx_GOTREF(__pyx_t_3);
5346  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5347  __pyx_t_2 = NULL;
5348  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5349  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
5350  if (likely(__pyx_t_2)) {
5351  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5352  __Pyx_INCREF(__pyx_t_2);
5353  __Pyx_INCREF(function);
5354  __Pyx_DECREF_SET(__pyx_t_3, function);
5355  }
5356  }
5357  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5358  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5359  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 773, __pyx_L1_error)
5360  __Pyx_GOTREF(__pyx_t_5);
5361  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5362  __pyx_v_init_tot_wall_time = __pyx_t_5;
5363  __pyx_t_5 = 0;
5364 
5365  /* "imate/traceinv/_hutchinson_method.pyx":774
5366  *
5367  * init_tot_wall_time = time.perf_counter()
5368  * init_cpu_proc_time = time.process_time() # <<<<<<<<<<<<<<
5369  *
5370  * # Generate orthogonalized random vectors with unit norm
5371  */
5372  __Pyx_TraceLine(774,0,__PYX_ERR(0, 774, __pyx_L1_error))
5373  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error)
5374  __Pyx_GOTREF(__pyx_t_3);
5375  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 774, __pyx_L1_error)
5376  __Pyx_GOTREF(__pyx_t_2);
5377  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5378  __pyx_t_3 = NULL;
5379  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
5380  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
5381  if (likely(__pyx_t_3)) {
5382  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
5383  __Pyx_INCREF(__pyx_t_3);
5384  __Pyx_INCREF(function);
5385  __Pyx_DECREF_SET(__pyx_t_2, function);
5386  }
5387  }
5388  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
5389  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
5390  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 774, __pyx_L1_error)
5391  __Pyx_GOTREF(__pyx_t_5);
5392  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5393  __pyx_v_init_cpu_proc_time = __pyx_t_5;
5394  __pyx_t_5 = 0;
5395 
5396  /* "imate/traceinv/_hutchinson_method.pyx":777
5397  *
5398  * # Generate orthogonalized random vectors with unit norm
5399  * generate_random_column_vectors[float](cE, vector_size, max_num_samples, # <<<<<<<<<<<<<<
5400  * int(orthogonalize), seed,
5401  * num_threads)
5402  */
5403  __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
5404  __pyx_t_9 = __Pyx_PyInt_As_LongIndexType(__pyx_v_vector_size); if (unlikely((__pyx_t_9 == ((LongIndexType)-1)) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
5405  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 777, __pyx_L1_error)
5406 
5407  /* "imate/traceinv/_hutchinson_method.pyx":778
5408  * # Generate orthogonalized random vectors with unit norm
5409  * generate_random_column_vectors[float](cE, vector_size, max_num_samples,
5410  * int(orthogonalize), seed, # <<<<<<<<<<<<<<
5411  * num_threads)
5412  *
5413  */
5414  __Pyx_TraceLine(778,0,__PYX_ERR(0, 778, __pyx_L1_error))
5415  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_orthogonalize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error)
5416  __Pyx_GOTREF(__pyx_t_5);
5417  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error)
5418  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5419  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_seed); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 778, __pyx_L1_error)
5420 
5421  /* "imate/traceinv/_hutchinson_method.pyx":779
5422  * generate_random_column_vectors[float](cE, vector_size, max_num_samples,
5423  * int(orthogonalize), seed,
5424  * num_threads) # <<<<<<<<<<<<<<
5425  *
5426  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float32)
5427  */
5428  __Pyx_TraceLine(779,0,__PYX_ERR(0, 779, __pyx_L1_error))
5429  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_num_threads); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 779, __pyx_L1_error)
5430 
5431  /* "imate/traceinv/_hutchinson_method.pyx":777
5432  *
5433  * # Generate orthogonalized random vectors with unit norm
5434  * generate_random_column_vectors[float](cE, vector_size, max_num_samples, # <<<<<<<<<<<<<<
5435  * int(orthogonalize), seed,
5436  * num_threads)
5437  */
5438  __Pyx_TraceLine(777,0,__PYX_ERR(0, 777, __pyx_L1_error))
5439  __pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors(__pyx_v_cE, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13);
5440 
5441  /* "imate/traceinv/_hutchinson_method.pyx":781
5442  * num_threads)
5443  *
5444  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float32) # <<<<<<<<<<<<<<
5445  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
5446  * samples[:] = numpy.nan
5447  */
5448  __Pyx_TraceLine(781,0,__PYX_ERR(0, 781, __pyx_L1_error))
5449  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5450  __Pyx_GOTREF(__pyx_t_5);
5451  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 781, __pyx_L1_error)
5452  __Pyx_GOTREF(__pyx_t_2);
5453  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5454  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5455  __Pyx_GOTREF(__pyx_t_5);
5456  __Pyx_INCREF(__pyx_v_max_num_samples);
5457  __Pyx_GIVEREF(__pyx_v_max_num_samples);
5458  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_max_num_samples);
5459  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 781, __pyx_L1_error)
5460  __Pyx_GOTREF(__pyx_t_3);
5461  __Pyx_GIVEREF(__pyx_t_5);
5462  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
5463  __pyx_t_5 = 0;
5464  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 781, __pyx_L1_error)
5465  __Pyx_GOTREF(__pyx_t_5);
5466  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 781, __pyx_L1_error)
5467  __Pyx_GOTREF(__pyx_t_1);
5468  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
5469  __Pyx_GOTREF(__pyx_t_4);
5470  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5471  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 781, __pyx_L1_error)
5472  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5473  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 781, __pyx_L1_error)
5474  __Pyx_GOTREF(__pyx_t_4);
5475  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5476  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5477  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5478  __pyx_v_samples = __pyx_t_4;
5479  __pyx_t_4 = 0;
5480 
5481  /* "imate/traceinv/_hutchinson_method.pyx":782
5482  *
5483  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float32)
5484  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int) # <<<<<<<<<<<<<<
5485  * samples[:] = numpy.nan
5486  * cdef int num_processed_samples = 0
5487  */
5488  __Pyx_TraceLine(782,0,__PYX_ERR(0, 782, __pyx_L1_error))
5489  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5490  __Pyx_GOTREF(__pyx_t_4);
5491  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 782, __pyx_L1_error)
5492  __Pyx_GOTREF(__pyx_t_5);
5493  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5494  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5495  __Pyx_GOTREF(__pyx_t_4);
5496  __Pyx_INCREF(__pyx_v_max_num_samples);
5497  __Pyx_GIVEREF(__pyx_v_max_num_samples);
5498  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_max_num_samples);
5499  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 782, __pyx_L1_error)
5500  __Pyx_GOTREF(__pyx_t_3);
5501  __Pyx_GIVEREF(__pyx_t_4);
5502  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
5503  __pyx_t_4 = 0;
5504  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 782, __pyx_L1_error)
5505  __Pyx_GOTREF(__pyx_t_4);
5506  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 782, __pyx_L1_error)
5507  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 782, __pyx_L1_error)
5508  __Pyx_GOTREF(__pyx_t_2);
5509  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5510  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5511  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5512  __pyx_v_processed_samples_indices = __pyx_t_2;
5513  __pyx_t_2 = 0;
5514 
5515  /* "imate/traceinv/_hutchinson_method.pyx":783
5516  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float32)
5517  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
5518  * samples[:] = numpy.nan # <<<<<<<<<<<<<<
5519  * cdef int num_processed_samples = 0
5520  * cdef int num_samples_used = 0
5521  */
5522  __Pyx_TraceLine(783,0,__PYX_ERR(0, 783, __pyx_L1_error))
5523  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 783, __pyx_L1_error)
5524  __Pyx_GOTREF(__pyx_t_2);
5525  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 783, __pyx_L1_error)
5526  __Pyx_GOTREF(__pyx_t_4);
5527  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5528  if (__Pyx_PyObject_SetSlice(__pyx_v_samples, __pyx_t_4, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 0) < 0) __PYX_ERR(0, 783, __pyx_L1_error)
5529  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5530 
5531  /* "imate/traceinv/_hutchinson_method.pyx":784
5532  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
5533  * samples[:] = numpy.nan
5534  * cdef int num_processed_samples = 0 # <<<<<<<<<<<<<<
5535  * cdef int num_samples_used = 0
5536  * cdef int converged = 0
5537  */
5538  __Pyx_TraceLine(784,0,__PYX_ERR(0, 784, __pyx_L1_error))
5539  __pyx_v_num_processed_samples = 0;
5540 
5541  /* "imate/traceinv/_hutchinson_method.pyx":785
5542  * samples[:] = numpy.nan
5543  * cdef int num_processed_samples = 0
5544  * cdef int num_samples_used = 0 # <<<<<<<<<<<<<<
5545  * cdef int converged = 0
5546  *
5547  */
5548  __Pyx_TraceLine(785,0,__PYX_ERR(0, 785, __pyx_L1_error))
5549  __pyx_v_num_samples_used = 0;
5550 
5551  /* "imate/traceinv/_hutchinson_method.pyx":786
5552  * cdef int num_processed_samples = 0
5553  * cdef int num_samples_used = 0
5554  * cdef int converged = 0 # <<<<<<<<<<<<<<
5555  *
5556  * init_alg_wall_time = time.perf_counter()
5557  */
5558  __Pyx_TraceLine(786,0,__PYX_ERR(0, 786, __pyx_L1_error))
5559  __pyx_v_converged = 0;
5560 
5561  /* "imate/traceinv/_hutchinson_method.pyx":788
5562  * cdef int converged = 0
5563  *
5564  * init_alg_wall_time = time.perf_counter() # <<<<<<<<<<<<<<
5565  *
5566  * # Compute Gramian matrix if needed
5567  */
5568  __Pyx_TraceLine(788,0,__PYX_ERR(0, 788, __pyx_L1_error))
5569  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 788, __pyx_L1_error)
5570  __Pyx_GOTREF(__pyx_t_2);
5571  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 788, __pyx_L1_error)
5572  __Pyx_GOTREF(__pyx_t_3);
5573  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5574  __pyx_t_2 = NULL;
5575  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5576  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
5577  if (likely(__pyx_t_2)) {
5578  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5579  __Pyx_INCREF(__pyx_t_2);
5580  __Pyx_INCREF(function);
5581  __Pyx_DECREF_SET(__pyx_t_3, function);
5582  }
5583  }
5584  __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
5585  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
5586  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 788, __pyx_L1_error)
5587  __Pyx_GOTREF(__pyx_t_4);
5588  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5589  __pyx_v_init_alg_wall_time = __pyx_t_4;
5590  __pyx_t_4 = 0;
5591 
5592  /* "imate/traceinv/_hutchinson_method.pyx":791
5593  *
5594  * # Compute Gramian matrix if needed
5595  * if gram: # <<<<<<<<<<<<<<
5596  * if (p == 1) and (B is None) and (C is None):
5597  * # This special case does not needed the computation of Gramian.
5598  */
5599  __Pyx_TraceLine(791,0,__PYX_ERR(0, 791, __pyx_L1_error))
5600  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 791, __pyx_L1_error)
5601  if (__pyx_t_14) {
5602 
5603  /* "imate/traceinv/_hutchinson_method.pyx":792
5604  * # Compute Gramian matrix if needed
5605  * if gram:
5606  * if (p == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
5607  * # This special case does not needed the computation of Gramian.
5608  * AtA = None
5609  */
5610  __Pyx_TraceLine(792,0,__PYX_ERR(0, 792, __pyx_L1_error))
5611  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 792, __pyx_L1_error)
5612  __Pyx_GOTREF(__pyx_t_4);
5613  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 792, __pyx_L1_error)
5614  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5615  if (__pyx_t_15) {
5616  } else {
5617  __pyx_t_14 = __pyx_t_15;
5618  goto __pyx_L5_bool_binop_done;
5619  }
5620  __pyx_t_15 = (__pyx_v_B == Py_None);
5621  __pyx_t_16 = (__pyx_t_15 != 0);
5622  if (__pyx_t_16) {
5623  } else {
5624  __pyx_t_14 = __pyx_t_16;
5625  goto __pyx_L5_bool_binop_done;
5626  }
5627  __pyx_t_16 = (__pyx_v_C == Py_None);
5628  __pyx_t_15 = (__pyx_t_16 != 0);
5629  __pyx_t_14 = __pyx_t_15;
5630  __pyx_L5_bool_binop_done:;
5631  if (__pyx_t_14) {
5632 
5633  /* "imate/traceinv/_hutchinson_method.pyx":794
5634  * if (p == 1) and (B is None) and (C is None):
5635  * # This special case does not needed the computation of Gramian.
5636  * AtA = None # <<<<<<<<<<<<<<
5637  * else:
5638  * AtA = A.T @ A
5639  */
5640  __Pyx_TraceLine(794,0,__PYX_ERR(0, 794, __pyx_L1_error))
5641  __Pyx_INCREF(Py_None);
5642  __pyx_v_AtA = Py_None;
5643 
5644  /* "imate/traceinv/_hutchinson_method.pyx":792
5645  * # Compute Gramian matrix if needed
5646  * if gram:
5647  * if (p == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
5648  * # This special case does not needed the computation of Gramian.
5649  * AtA = None
5650  */
5651  goto __pyx_L4;
5652  }
5653 
5654  /* "imate/traceinv/_hutchinson_method.pyx":796
5655  * AtA = None
5656  * else:
5657  * AtA = A.T @ A # <<<<<<<<<<<<<<
5658  * else:
5659  * AtA = None
5660  */
5661  __Pyx_TraceLine(796,0,__PYX_ERR(0, 796, __pyx_L1_error))
5662  /*else*/ {
5663  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 796, __pyx_L1_error)
5664  __Pyx_GOTREF(__pyx_t_4);
5665  __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_v_A); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 796, __pyx_L1_error)
5666  __Pyx_GOTREF(__pyx_t_3);
5667  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5668  __pyx_v_AtA = __pyx_t_3;
5669  __pyx_t_3 = 0;
5670  }
5671  __pyx_L4:;
5672 
5673  /* "imate/traceinv/_hutchinson_method.pyx":791
5674  *
5675  * # Compute Gramian matrix if needed
5676  * if gram: # <<<<<<<<<<<<<<
5677  * if (p == 1) and (B is None) and (C is None):
5678  * # This special case does not needed the computation of Gramian.
5679  */
5680  goto __pyx_L3;
5681  }
5682 
5683  /* "imate/traceinv/_hutchinson_method.pyx":798
5684  * AtA = A.T @ A
5685  * else:
5686  * AtA = None # <<<<<<<<<<<<<<
5687  *
5688  * # Monte-Carlo sampling
5689  */
5690  __Pyx_TraceLine(798,0,__PYX_ERR(0, 798, __pyx_L1_error))
5691  /*else*/ {
5692  __Pyx_INCREF(Py_None);
5693  __pyx_v_AtA = Py_None;
5694  }
5695  __pyx_L3:;
5696 
5697  /* "imate/traceinv/_hutchinson_method.pyx":801
5698  *
5699  * # Monte-Carlo sampling
5700  * for i in range(max_num_samples): # <<<<<<<<<<<<<<
5701  *
5702  * if converged == 0:
5703  */
5704  __Pyx_TraceLine(801,0,__PYX_ERR(0, 801, __pyx_L1_error))
5705  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_max_num_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5706  __Pyx_GOTREF(__pyx_t_3);
5707  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
5708  __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_17 = 0;
5709  __pyx_t_18 = NULL;
5710  } else {
5711  __pyx_t_17 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 801, __pyx_L1_error)
5712  __Pyx_GOTREF(__pyx_t_4);
5713  __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 801, __pyx_L1_error)
5714  }
5715  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5716  for (;;) {
5717  if (likely(!__pyx_t_18)) {
5718  if (likely(PyList_CheckExact(__pyx_t_4))) {
5719  if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_4)) break;
5720  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5721  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
5722  #else
5723  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5724  __Pyx_GOTREF(__pyx_t_3);
5725  #endif
5726  } else {
5727  if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
5728  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5729  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 801, __pyx_L1_error)
5730  #else
5731  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 801, __pyx_L1_error)
5732  __Pyx_GOTREF(__pyx_t_3);
5733  #endif
5734  }
5735  } else {
5736  __pyx_t_3 = __pyx_t_18(__pyx_t_4);
5737  if (unlikely(!__pyx_t_3)) {
5738  PyObject* exc_type = PyErr_Occurred();
5739  if (exc_type) {
5740  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
5741  else __PYX_ERR(0, 801, __pyx_L1_error)
5742  }
5743  break;
5744  }
5745  __Pyx_GOTREF(__pyx_t_3);
5746  }
5747  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
5748  __pyx_t_3 = 0;
5749 
5750  /* "imate/traceinv/_hutchinson_method.pyx":803
5751  * for i in range(max_num_samples):
5752  *
5753  * if converged == 0: # <<<<<<<<<<<<<<
5754  *
5755  * # Stochastic estimator of trace using the i-th column of E
5756  */
5757  __Pyx_TraceLine(803,0,__PYX_ERR(0, 803, __pyx_L1_error))
5758  __pyx_t_14 = ((__pyx_v_converged == 0) != 0);
5759  if (__pyx_t_14) {
5760 
5761  /* "imate/traceinv/_hutchinson_method.pyx":807
5762  * # Stochastic estimator of trace using the i-th column of E
5763  * samples[i] = _stochastic_trace_estimator_float(
5764  * A, AtA, B, C, E[:, i], gram, p, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
5765  *
5766  * # Store the index of processed samples
5767  */
5768  __Pyx_TraceLine(807,0,__PYX_ERR(0, 807, __pyx_L1_error))
5769  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 807, __pyx_L1_error)
5770  __Pyx_GOTREF(__pyx_t_3);
5771  __Pyx_INCREF(__pyx_slice__4);
5772  __Pyx_GIVEREF(__pyx_slice__4);
5773  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__4);
5774  __Pyx_INCREF(__pyx_v_i);
5775  __Pyx_GIVEREF(__pyx_v_i);
5776  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
5777  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_E, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 807, __pyx_L1_error)
5778  __Pyx_GOTREF(__pyx_t_2);
5779  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5780 
5781  /* "imate/traceinv/_hutchinson_method.pyx":806
5782  *
5783  * # Stochastic estimator of trace using the i-th column of E
5784  * samples[i] = _stochastic_trace_estimator_float( # <<<<<<<<<<<<<<
5785  * A, AtA, B, C, E[:, i], gram, p, assume_matrix, solver_tol)
5786  *
5787  */
5788  __Pyx_TraceLine(806,0,__PYX_ERR(0, 806, __pyx_L1_error))
5789  __pyx_t_19 = __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(__pyx_v_A, __pyx_v_AtA, __pyx_v_B, __pyx_v_C, __pyx_t_2, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_solver_tol); if (unlikely(__pyx_t_19 == ((float)-1) && PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L1_error)
5790  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5791  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_19); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 806, __pyx_L1_error)
5792  __Pyx_GOTREF(__pyx_t_2);
5793  if (unlikely(PyObject_SetItem(__pyx_v_samples, __pyx_v_i, __pyx_t_2) < 0)) __PYX_ERR(0, 806, __pyx_L1_error)
5794  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5795 
5796  /* "imate/traceinv/_hutchinson_method.pyx":810
5797  *
5798  * # Store the index of processed samples
5799  * processed_samples_indices[num_processed_samples] = i # <<<<<<<<<<<<<<
5800  * num_processed_samples += 1
5801  *
5802  */
5803  __Pyx_TraceLine(810,0,__PYX_ERR(0, 810, __pyx_L1_error))
5804  if (unlikely(__Pyx_SetItemInt(__pyx_v_processed_samples_indices, __pyx_v_num_processed_samples, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 810, __pyx_L1_error)
5805 
5806  /* "imate/traceinv/_hutchinson_method.pyx":811
5807  * # Store the index of processed samples
5808  * processed_samples_indices[num_processed_samples] = i
5809  * num_processed_samples += 1 # <<<<<<<<<<<<<<
5810  *
5811  * # Check whether convergence criterion has been met to stop.
5812  */
5813  __Pyx_TraceLine(811,0,__PYX_ERR(0, 811, __pyx_L1_error))
5814  __pyx_v_num_processed_samples = (__pyx_v_num_processed_samples + 1);
5815 
5816  /* "imate/traceinv/_hutchinson_method.pyx":816
5817  * # This check can also be done after another parallel thread
5818  * # set all_converged to "1", but we continue to update error.
5819  * converged, num_samples_used = check_convergence( # <<<<<<<<<<<<<<
5820  * samples, min_num_samples, processed_samples_indices,
5821  * num_processed_samples, confidence_level, error_atol,
5822  */
5823  __Pyx_TraceLine(816,0,__PYX_ERR(0, 816, __pyx_L1_error))
5824  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_check_convergence); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error)
5825  __Pyx_GOTREF(__pyx_t_3);
5826 
5827  /* "imate/traceinv/_hutchinson_method.pyx":818
5828  * converged, num_samples_used = check_convergence(
5829  * samples, min_num_samples, processed_samples_indices,
5830  * num_processed_samples, confidence_level, error_atol, # <<<<<<<<<<<<<<
5831  * error_rtol)
5832  *
5833  */
5834  __Pyx_TraceLine(818,0,__PYX_ERR(0, 818, __pyx_L1_error))
5835  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 818, __pyx_L1_error)
5836  __Pyx_GOTREF(__pyx_t_5);
5837 
5838  /* "imate/traceinv/_hutchinson_method.pyx":819
5839  * samples, min_num_samples, processed_samples_indices,
5840  * num_processed_samples, confidence_level, error_atol,
5841  * error_rtol) # <<<<<<<<<<<<<<
5842  *
5843  * alg_wall_time = time.perf_counter() - init_alg_wall_time
5844  */
5845  __Pyx_TraceLine(819,0,__PYX_ERR(0, 819, __pyx_L1_error))
5846  __pyx_t_1 = NULL;
5847  __pyx_t_20 = 0;
5848  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
5849  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
5850  if (likely(__pyx_t_1)) {
5851  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
5852  __Pyx_INCREF(__pyx_t_1);
5853  __Pyx_INCREF(function);
5854  __Pyx_DECREF_SET(__pyx_t_3, function);
5855  __pyx_t_20 = 1;
5856  }
5857  }
5858  #if CYTHON_FAST_PYCALL
5859  if (PyFunction_Check(__pyx_t_3)) {
5860  PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
5861  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5862  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5863  __Pyx_GOTREF(__pyx_t_2);
5864  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5865  } else
5866  #endif
5867  #if CYTHON_FAST_PYCCALL
5868  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
5869  PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
5870  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5871  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
5872  __Pyx_GOTREF(__pyx_t_2);
5873  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5874  } else
5875  #endif
5876  {
5877  __pyx_t_21 = PyTuple_New(7+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 816, __pyx_L1_error)
5878  __Pyx_GOTREF(__pyx_t_21);
5879  if (__pyx_t_1) {
5880  __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); __pyx_t_1 = NULL;
5881  }
5882  __Pyx_INCREF(__pyx_v_samples);
5883  __Pyx_GIVEREF(__pyx_v_samples);
5884  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_v_samples);
5885  __Pyx_INCREF(__pyx_v_min_num_samples);
5886  __Pyx_GIVEREF(__pyx_v_min_num_samples);
5887  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_v_min_num_samples);
5888  __Pyx_INCREF(__pyx_v_processed_samples_indices);
5889  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
5890  PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_20, __pyx_v_processed_samples_indices);
5891  __Pyx_GIVEREF(__pyx_t_5);
5892  PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_20, __pyx_t_5);
5893  __Pyx_INCREF(__pyx_v_confidence_level);
5894  __Pyx_GIVEREF(__pyx_v_confidence_level);
5895  PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_20, __pyx_v_confidence_level);
5896  __Pyx_INCREF(__pyx_v_error_atol);
5897  __Pyx_GIVEREF(__pyx_v_error_atol);
5898  PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_20, __pyx_v_error_atol);
5899  __Pyx_INCREF(__pyx_v_error_rtol);
5900  __Pyx_GIVEREF(__pyx_v_error_rtol);
5901  PyTuple_SET_ITEM(__pyx_t_21, 6+__pyx_t_20, __pyx_v_error_rtol);
5902  __pyx_t_5 = 0;
5903  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 816, __pyx_L1_error)
5904  __Pyx_GOTREF(__pyx_t_2);
5905  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5906  }
5907  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5908  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
5909  PyObject* sequence = __pyx_t_2;
5910  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
5911  if (unlikely(size != 2)) {
5912  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
5913  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
5914  __PYX_ERR(0, 816, __pyx_L1_error)
5915  }
5916  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
5917  if (likely(PyTuple_CheckExact(sequence))) {
5918  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
5919  __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1);
5920  } else {
5921  __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
5922  __pyx_t_21 = PyList_GET_ITEM(sequence, 1);
5923  }
5924  __Pyx_INCREF(__pyx_t_3);
5925  __Pyx_INCREF(__pyx_t_21);
5926  #else
5927  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 816, __pyx_L1_error)
5928  __Pyx_GOTREF(__pyx_t_3);
5929  __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 816, __pyx_L1_error)
5930  __Pyx_GOTREF(__pyx_t_21);
5931  #endif
5932  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5933  } else {
5934  Py_ssize_t index = -1;
5935  __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 816, __pyx_L1_error)
5936  __Pyx_GOTREF(__pyx_t_5);
5937  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5938  __pyx_t_22 = Py_TYPE(__pyx_t_5)->tp_iternext;
5939  index = 0; __pyx_t_3 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
5940  __Pyx_GOTREF(__pyx_t_3);
5941  index = 1; __pyx_t_21 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_21)) goto __pyx_L11_unpacking_failed;
5942  __Pyx_GOTREF(__pyx_t_21);
5943  if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_5), 2) < 0) __PYX_ERR(0, 816, __pyx_L1_error)
5944  __pyx_t_22 = NULL;
5945  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5946  goto __pyx_L12_unpacking_done;
5947  __pyx_L11_unpacking_failed:;
5948  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5949  __pyx_t_22 = NULL;
5950  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
5951  __PYX_ERR(0, 816, __pyx_L1_error)
5952  __pyx_L12_unpacking_done:;
5953  }
5954 
5955  /* "imate/traceinv/_hutchinson_method.pyx":816
5956  * # This check can also be done after another parallel thread
5957  * # set all_converged to "1", but we continue to update error.
5958  * converged, num_samples_used = check_convergence( # <<<<<<<<<<<<<<
5959  * samples, min_num_samples, processed_samples_indices,
5960  * num_processed_samples, confidence_level, error_atol,
5961  */
5962  __Pyx_TraceLine(816,0,__PYX_ERR(0, 816, __pyx_L1_error))
5963  __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
5964  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5965  __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_23 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 816, __pyx_L1_error)
5966  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
5967  __pyx_v_converged = __pyx_t_20;
5968  __pyx_v_num_samples_used = __pyx_t_23;
5969 
5970  /* "imate/traceinv/_hutchinson_method.pyx":803
5971  * for i in range(max_num_samples):
5972  *
5973  * if converged == 0: # <<<<<<<<<<<<<<
5974  *
5975  * # Stochastic estimator of trace using the i-th column of E
5976  */
5977  }
5978 
5979  /* "imate/traceinv/_hutchinson_method.pyx":801
5980  *
5981  * # Monte-Carlo sampling
5982  * for i in range(max_num_samples): # <<<<<<<<<<<<<<
5983  *
5984  * if converged == 0:
5985  */
5986  __Pyx_TraceLine(801,0,__PYX_ERR(0, 801, __pyx_L1_error))
5987  }
5988  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5989 
5990  /* "imate/traceinv/_hutchinson_method.pyx":821
5991  * error_rtol)
5992  *
5993  * alg_wall_time = time.perf_counter() - init_alg_wall_time # <<<<<<<<<<<<<<
5994  *
5995  * trace, error, num_outliers = average_estimates(
5996  */
5997  __Pyx_TraceLine(821,0,__PYX_ERR(0, 821, __pyx_L1_error))
5998  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 821, __pyx_L1_error)
5999  __Pyx_GOTREF(__pyx_t_2);
6000  __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 821, __pyx_L1_error)
6001  __Pyx_GOTREF(__pyx_t_21);
6002  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6003  __pyx_t_2 = NULL;
6004  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
6005  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_21);
6006  if (likely(__pyx_t_2)) {
6007  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
6008  __Pyx_INCREF(__pyx_t_2);
6009  __Pyx_INCREF(function);
6010  __Pyx_DECREF_SET(__pyx_t_21, function);
6011  }
6012  }
6013  __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_21);
6014  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6015  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 821, __pyx_L1_error)
6016  __Pyx_GOTREF(__pyx_t_4);
6017  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6018  __pyx_t_21 = PyNumber_Subtract(__pyx_t_4, __pyx_v_init_alg_wall_time); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 821, __pyx_L1_error)
6019  __Pyx_GOTREF(__pyx_t_21);
6020  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6021  __pyx_v_alg_wall_time = __pyx_t_21;
6022  __pyx_t_21 = 0;
6023 
6024  /* "imate/traceinv/_hutchinson_method.pyx":823
6025  * alg_wall_time = time.perf_counter() - init_alg_wall_time
6026  *
6027  * trace, error, num_outliers = average_estimates( # <<<<<<<<<<<<<<
6028  * confidence_level, outlier_significance_level, max_num_samples,
6029  * num_samples_used, processed_samples_indices, samples)
6030  */
6031  __Pyx_TraceLine(823,0,__PYX_ERR(0, 823, __pyx_L1_error))
6032  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_average_estimates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
6033  __Pyx_GOTREF(__pyx_t_4);
6034 
6035  /* "imate/traceinv/_hutchinson_method.pyx":825
6036  * trace, error, num_outliers = average_estimates(
6037  * confidence_level, outlier_significance_level, max_num_samples,
6038  * num_samples_used, processed_samples_indices, samples) # <<<<<<<<<<<<<<
6039  *
6040  * tot_wall_time = time.perf_counter() - init_tot_wall_time
6041  */
6042  __Pyx_TraceLine(825,0,__PYX_ERR(0, 825, __pyx_L1_error))
6043  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 825, __pyx_L1_error)
6044  __Pyx_GOTREF(__pyx_t_2);
6045  __pyx_t_3 = NULL;
6046  __pyx_t_23 = 0;
6047  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
6048  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
6049  if (likely(__pyx_t_3)) {
6050  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
6051  __Pyx_INCREF(__pyx_t_3);
6052  __Pyx_INCREF(function);
6053  __Pyx_DECREF_SET(__pyx_t_4, function);
6054  __pyx_t_23 = 1;
6055  }
6056  }
6057  #if CYTHON_FAST_PYCALL
6058  if (PyFunction_Check(__pyx_t_4)) {
6059  PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
6060  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6061  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6062  __Pyx_GOTREF(__pyx_t_21);
6063  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6064  } else
6065  #endif
6066  #if CYTHON_FAST_PYCCALL
6067  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
6068  PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
6069  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6070  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6071  __Pyx_GOTREF(__pyx_t_21);
6072  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6073  } else
6074  #endif
6075  {
6076  __pyx_t_5 = PyTuple_New(6+__pyx_t_23); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
6077  __Pyx_GOTREF(__pyx_t_5);
6078  if (__pyx_t_3) {
6079  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
6080  }
6081  __Pyx_INCREF(__pyx_v_confidence_level);
6082  __Pyx_GIVEREF(__pyx_v_confidence_level);
6083  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_23, __pyx_v_confidence_level);
6084  __Pyx_INCREF(__pyx_v_outlier_significance_level);
6085  __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
6086  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_23, __pyx_v_outlier_significance_level);
6087  __Pyx_INCREF(__pyx_v_max_num_samples);
6088  __Pyx_GIVEREF(__pyx_v_max_num_samples);
6089  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_23, __pyx_v_max_num_samples);
6090  __Pyx_GIVEREF(__pyx_t_2);
6091  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_23, __pyx_t_2);
6092  __Pyx_INCREF(__pyx_v_processed_samples_indices);
6093  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
6094  PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_23, __pyx_v_processed_samples_indices);
6095  __Pyx_INCREF(__pyx_v_samples);
6096  __Pyx_GIVEREF(__pyx_v_samples);
6097  PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_23, __pyx_v_samples);
6098  __pyx_t_2 = 0;
6099  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 823, __pyx_L1_error)
6100  __Pyx_GOTREF(__pyx_t_21);
6101  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6102  }
6103  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6104  if ((likely(PyTuple_CheckExact(__pyx_t_21))) || (PyList_CheckExact(__pyx_t_21))) {
6105  PyObject* sequence = __pyx_t_21;
6106  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
6107  if (unlikely(size != 3)) {
6108  if (size > 3) __Pyx_RaiseTooManyValuesError(3);
6109  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
6110  __PYX_ERR(0, 823, __pyx_L1_error)
6111  }
6112  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6113  if (likely(PyTuple_CheckExact(sequence))) {
6114  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
6115  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
6116  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2);
6117  } else {
6118  __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
6119  __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
6120  __pyx_t_2 = PyList_GET_ITEM(sequence, 2);
6121  }
6122  __Pyx_INCREF(__pyx_t_4);
6123  __Pyx_INCREF(__pyx_t_5);
6124  __Pyx_INCREF(__pyx_t_2);
6125  #else
6126  __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 823, __pyx_L1_error)
6127  __Pyx_GOTREF(__pyx_t_4);
6128  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 823, __pyx_L1_error)
6129  __Pyx_GOTREF(__pyx_t_5);
6130  __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 823, __pyx_L1_error)
6131  __Pyx_GOTREF(__pyx_t_2);
6132  #endif
6133  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6134  } else {
6135  Py_ssize_t index = -1;
6136  __pyx_t_3 = PyObject_GetIter(__pyx_t_21); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 823, __pyx_L1_error)
6137  __Pyx_GOTREF(__pyx_t_3);
6138  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6139  __pyx_t_22 = Py_TYPE(__pyx_t_3)->tp_iternext;
6140  index = 0; __pyx_t_4 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L13_unpacking_failed;
6141  __Pyx_GOTREF(__pyx_t_4);
6142  index = 1; __pyx_t_5 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
6143  __Pyx_GOTREF(__pyx_t_5);
6144  index = 2; __pyx_t_2 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L13_unpacking_failed;
6145  __Pyx_GOTREF(__pyx_t_2);
6146  if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_3), 3) < 0) __PYX_ERR(0, 823, __pyx_L1_error)
6147  __pyx_t_22 = NULL;
6148  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6149  goto __pyx_L14_unpacking_done;
6150  __pyx_L13_unpacking_failed:;
6151  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6152  __pyx_t_22 = NULL;
6153  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
6154  __PYX_ERR(0, 823, __pyx_L1_error)
6155  __pyx_L14_unpacking_done:;
6156  }
6157 
6158  /* "imate/traceinv/_hutchinson_method.pyx":823
6159  * alg_wall_time = time.perf_counter() - init_alg_wall_time
6160  *
6161  * trace, error, num_outliers = average_estimates( # <<<<<<<<<<<<<<
6162  * confidence_level, outlier_significance_level, max_num_samples,
6163  * num_samples_used, processed_samples_indices, samples)
6164  */
6165  __Pyx_TraceLine(823,0,__PYX_ERR(0, 823, __pyx_L1_error))
6166  __pyx_v_trace = __pyx_t_4;
6167  __pyx_t_4 = 0;
6168  __pyx_v_error = __pyx_t_5;
6169  __pyx_t_5 = 0;
6170  __pyx_v_num_outliers = __pyx_t_2;
6171  __pyx_t_2 = 0;
6172 
6173  /* "imate/traceinv/_hutchinson_method.pyx":827
6174  * num_samples_used, processed_samples_indices, samples)
6175  *
6176  * tot_wall_time = time.perf_counter() - init_tot_wall_time # <<<<<<<<<<<<<<
6177  * cpu_proc_time = time.process_time() - init_cpu_proc_time
6178  *
6179  */
6180  __Pyx_TraceLine(827,0,__PYX_ERR(0, 827, __pyx_L1_error))
6181  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 827, __pyx_L1_error)
6182  __Pyx_GOTREF(__pyx_t_2);
6183  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error)
6184  __Pyx_GOTREF(__pyx_t_5);
6185  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6186  __pyx_t_2 = NULL;
6187  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
6188  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
6189  if (likely(__pyx_t_2)) {
6190  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
6191  __Pyx_INCREF(__pyx_t_2);
6192  __Pyx_INCREF(function);
6193  __Pyx_DECREF_SET(__pyx_t_5, function);
6194  }
6195  }
6196  __pyx_t_21 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
6197  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6198  if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 827, __pyx_L1_error)
6199  __Pyx_GOTREF(__pyx_t_21);
6200  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6201  __pyx_t_5 = PyNumber_Subtract(__pyx_t_21, __pyx_v_init_tot_wall_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 827, __pyx_L1_error)
6202  __Pyx_GOTREF(__pyx_t_5);
6203  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6204  __pyx_v_tot_wall_time = __pyx_t_5;
6205  __pyx_t_5 = 0;
6206 
6207  /* "imate/traceinv/_hutchinson_method.pyx":828
6208  *
6209  * tot_wall_time = time.perf_counter() - init_tot_wall_time
6210  * cpu_proc_time = time.process_time() - init_cpu_proc_time # <<<<<<<<<<<<<<
6211  *
6212  * return trace, error, num_outliers, samples, processed_samples_indices, \
6213  */
6214  __Pyx_TraceLine(828,0,__PYX_ERR(0, 828, __pyx_L1_error))
6215  __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_time); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 828, __pyx_L1_error)
6216  __Pyx_GOTREF(__pyx_t_21);
6217  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_process_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
6218  __Pyx_GOTREF(__pyx_t_2);
6219  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
6220  __pyx_t_21 = NULL;
6221  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6222  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
6223  if (likely(__pyx_t_21)) {
6224  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6225  __Pyx_INCREF(__pyx_t_21);
6226  __Pyx_INCREF(function);
6227  __Pyx_DECREF_SET(__pyx_t_2, function);
6228  }
6229  }
6230  __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6231  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
6232  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 828, __pyx_L1_error)
6233  __Pyx_GOTREF(__pyx_t_5);
6234  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6235  __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_init_cpu_proc_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 828, __pyx_L1_error)
6236  __Pyx_GOTREF(__pyx_t_2);
6237  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6238  __pyx_v_cpu_proc_time = __pyx_t_2;
6239  __pyx_t_2 = 0;
6240 
6241  /* "imate/traceinv/_hutchinson_method.pyx":830
6242  * cpu_proc_time = time.process_time() - init_cpu_proc_time
6243  *
6244  * return trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
6245  * num_processed_samples, num_samples_used, converged, tot_wall_time, \
6246  * alg_wall_time, cpu_proc_time
6247  */
6248  __Pyx_TraceLine(830,0,__PYX_ERR(0, 830, __pyx_L1_error))
6249  __Pyx_XDECREF(__pyx_r);
6250 
6251  /* "imate/traceinv/_hutchinson_method.pyx":831
6252  *
6253  * return trace, error, num_outliers, samples, processed_samples_indices, \
6254  * num_processed_samples, num_samples_used, converged, tot_wall_time, \ # <<<<<<<<<<<<<<
6255  * alg_wall_time, cpu_proc_time
6256  *
6257  */
6258  __Pyx_TraceLine(831,0,__PYX_ERR(0, 831, __pyx_L1_error))
6259  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 831, __pyx_L1_error)
6260  __Pyx_GOTREF(__pyx_t_2);
6261  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error)
6262  __Pyx_GOTREF(__pyx_t_5);
6263  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_converged); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 831, __pyx_L1_error)
6264  __Pyx_GOTREF(__pyx_t_21);
6265 
6266  /* "imate/traceinv/_hutchinson_method.pyx":830
6267  * cpu_proc_time = time.process_time() - init_cpu_proc_time
6268  *
6269  * return trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
6270  * num_processed_samples, num_samples_used, converged, tot_wall_time, \
6271  * alg_wall_time, cpu_proc_time
6272  */
6273  __Pyx_TraceLine(830,0,__PYX_ERR(0, 830, __pyx_L1_error))
6274  __pyx_t_4 = PyTuple_New(11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 830, __pyx_L1_error)
6275  __Pyx_GOTREF(__pyx_t_4);
6276  __Pyx_INCREF(__pyx_v_trace);
6277  __Pyx_GIVEREF(__pyx_v_trace);
6278  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_trace);
6279  __Pyx_INCREF(__pyx_v_error);
6280  __Pyx_GIVEREF(__pyx_v_error);
6281  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_error);
6282  __Pyx_INCREF(__pyx_v_num_outliers);
6283  __Pyx_GIVEREF(__pyx_v_num_outliers);
6284  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_num_outliers);
6285  __Pyx_INCREF(__pyx_v_samples);
6286  __Pyx_GIVEREF(__pyx_v_samples);
6287  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_samples);
6288  __Pyx_INCREF(__pyx_v_processed_samples_indices);
6289  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
6290  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_processed_samples_indices);
6291  __Pyx_GIVEREF(__pyx_t_2);
6292  PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_2);
6293  __Pyx_GIVEREF(__pyx_t_5);
6294  PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_5);
6295  __Pyx_GIVEREF(__pyx_t_21);
6296  PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_21);
6297  __Pyx_INCREF(__pyx_v_tot_wall_time);
6298  __Pyx_GIVEREF(__pyx_v_tot_wall_time);
6299  PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_tot_wall_time);
6300  __Pyx_INCREF(__pyx_v_alg_wall_time);
6301  __Pyx_GIVEREF(__pyx_v_alg_wall_time);
6302  PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_v_alg_wall_time);
6303  __Pyx_INCREF(__pyx_v_cpu_proc_time);
6304  __Pyx_GIVEREF(__pyx_v_cpu_proc_time);
6305  PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_v_cpu_proc_time);
6306  __pyx_t_2 = 0;
6307  __pyx_t_5 = 0;
6308  __pyx_t_21 = 0;
6309  __pyx_r = __pyx_t_4;
6310  __pyx_t_4 = 0;
6311  goto __pyx_L0;
6312 
6313  /* "imate/traceinv/_hutchinson_method.pyx":741
6314  * # =======================
6315  *
6316  * def _hutchinson_method_float( # <<<<<<<<<<<<<<
6317  * A,
6318  * B,
6319  */
6320 
6321  /* function exit code */
6322  __pyx_L1_error:;
6323  __Pyx_XDECREF(__pyx_t_1);
6324  __Pyx_XDECREF(__pyx_t_2);
6325  __Pyx_XDECREF(__pyx_t_3);
6326  __Pyx_XDECREF(__pyx_t_4);
6327  __Pyx_XDECREF(__pyx_t_5);
6328  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6329  __Pyx_XDECREF(__pyx_t_21);
6330  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._hutchinson_method_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
6331  __pyx_r = NULL;
6332  __pyx_L0:;
6333  __Pyx_XDECREF(__pyx_v_vector_size);
6334  __Pyx_XDECREF(__pyx_v_E);
6335  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
6336  __Pyx_XDECREF(__pyx_v_init_tot_wall_time);
6337  __Pyx_XDECREF(__pyx_v_init_cpu_proc_time);
6338  __Pyx_XDECREF(__pyx_v_samples);
6339  __Pyx_XDECREF(__pyx_v_processed_samples_indices);
6340  __Pyx_XDECREF(__pyx_v_init_alg_wall_time);
6341  __Pyx_XDECREF(__pyx_v_AtA);
6342  __Pyx_XDECREF(__pyx_v_i);
6343  __Pyx_XDECREF(__pyx_v_alg_wall_time);
6344  __Pyx_XDECREF(__pyx_v_trace);
6345  __Pyx_XDECREF(__pyx_v_error);
6346  __Pyx_XDECREF(__pyx_v_num_outliers);
6347  __Pyx_XDECREF(__pyx_v_tot_wall_time);
6348  __Pyx_XDECREF(__pyx_v_cpu_proc_time);
6349  __Pyx_XGIVEREF(__pyx_r);
6350  __Pyx_TraceReturn(__pyx_r, 0);
6351  __Pyx_RefNannyFinishContext();
6352  return __pyx_r;
6353 }
6354 
6355 /* "imate/traceinv/_hutchinson_method.pyx":839
6356  * # ========================
6357  *
6358  * def _hutchinson_method_double( # <<<<<<<<<<<<<<
6359  * A,
6360  * B,
6361  */
6362 
6363 /* Python wrapper */
6364 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6365 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double[] = "_hutchinson_method_double(A, B, C, gram, p, assume_matrix, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, solver_tol, orthogonalize, seed, num_threads)\n\n This method processes double precision (64-bit) matrix ``A``.\n ";
6366 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double = {"_hutchinson_method_double", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double};
6367 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6368  PyObject *__pyx_v_A = 0;
6369  PyObject *__pyx_v_B = 0;
6370  PyObject *__pyx_v_C = 0;
6371  PyObject *__pyx_v_gram = 0;
6372  PyObject *__pyx_v_p = 0;
6373  PyObject *__pyx_v_assume_matrix = 0;
6374  PyObject *__pyx_v_min_num_samples = 0;
6375  PyObject *__pyx_v_max_num_samples = 0;
6376  PyObject *__pyx_v_error_atol = 0;
6377  PyObject *__pyx_v_error_rtol = 0;
6378  PyObject *__pyx_v_confidence_level = 0;
6379  PyObject *__pyx_v_outlier_significance_level = 0;
6380  PyObject *__pyx_v_solver_tol = 0;
6381  PyObject *__pyx_v_orthogonalize = 0;
6382  PyObject *__pyx_v_seed = 0;
6383  PyObject *__pyx_v_num_threads = 0;
6384  int __pyx_lineno = 0;
6385  const char *__pyx_filename = NULL;
6386  int __pyx_clineno = 0;
6387  PyObject *__pyx_r = 0;
6388  __Pyx_RefNannyDeclarations
6389  __Pyx_RefNannySetupContext("_hutchinson_method_double (wrapper)", 0);
6390  {
6391  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_B,&__pyx_n_s_C,&__pyx_n_s_gram,&__pyx_n_s_p,&__pyx_n_s_assume_matrix,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_solver_tol,&__pyx_n_s_orthogonalize,&__pyx_n_s_seed,&__pyx_n_s_num_threads,0};
6392  PyObject* values[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
6393  if (unlikely(__pyx_kwds)) {
6394  Py_ssize_t kw_args;
6395  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6396  switch (pos_args) {
6397  case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
6398  CYTHON_FALLTHROUGH;
6399  case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
6400  CYTHON_FALLTHROUGH;
6401  case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
6402  CYTHON_FALLTHROUGH;
6403  case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
6404  CYTHON_FALLTHROUGH;
6405  case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
6406  CYTHON_FALLTHROUGH;
6407  case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6408  CYTHON_FALLTHROUGH;
6409  case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6410  CYTHON_FALLTHROUGH;
6411  case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6412  CYTHON_FALLTHROUGH;
6413  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6414  CYTHON_FALLTHROUGH;
6415  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6416  CYTHON_FALLTHROUGH;
6417  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6418  CYTHON_FALLTHROUGH;
6419  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6420  CYTHON_FALLTHROUGH;
6421  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6422  CYTHON_FALLTHROUGH;
6423  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6424  CYTHON_FALLTHROUGH;
6425  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6426  CYTHON_FALLTHROUGH;
6427  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6428  CYTHON_FALLTHROUGH;
6429  case 0: break;
6430  default: goto __pyx_L5_argtuple_error;
6431  }
6432  kw_args = PyDict_Size(__pyx_kwds);
6433  switch (pos_args) {
6434  case 0:
6435  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
6436  else goto __pyx_L5_argtuple_error;
6437  CYTHON_FALLTHROUGH;
6438  case 1:
6439  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
6440  else {
6441  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 1); __PYX_ERR(0, 839, __pyx_L3_error)
6442  }
6443  CYTHON_FALLTHROUGH;
6444  case 2:
6445  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_C)) != 0)) kw_args--;
6446  else {
6447  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 2); __PYX_ERR(0, 839, __pyx_L3_error)
6448  }
6449  CYTHON_FALLTHROUGH;
6450  case 3:
6451  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
6452  else {
6453  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 3); __PYX_ERR(0, 839, __pyx_L3_error)
6454  }
6455  CYTHON_FALLTHROUGH;
6456  case 4:
6457  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
6458  else {
6459  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 4); __PYX_ERR(0, 839, __pyx_L3_error)
6460  }
6461  CYTHON_FALLTHROUGH;
6462  case 5:
6463  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
6464  else {
6465  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 5); __PYX_ERR(0, 839, __pyx_L3_error)
6466  }
6467  CYTHON_FALLTHROUGH;
6468  case 6:
6469  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
6470  else {
6471  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 6); __PYX_ERR(0, 839, __pyx_L3_error)
6472  }
6473  CYTHON_FALLTHROUGH;
6474  case 7:
6475  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
6476  else {
6477  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 7); __PYX_ERR(0, 839, __pyx_L3_error)
6478  }
6479  CYTHON_FALLTHROUGH;
6480  case 8:
6481  if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
6482  else {
6483  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 8); __PYX_ERR(0, 839, __pyx_L3_error)
6484  }
6485  CYTHON_FALLTHROUGH;
6486  case 9:
6487  if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
6488  else {
6489  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 9); __PYX_ERR(0, 839, __pyx_L3_error)
6490  }
6491  CYTHON_FALLTHROUGH;
6492  case 10:
6493  if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
6494  else {
6495  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 10); __PYX_ERR(0, 839, __pyx_L3_error)
6496  }
6497  CYTHON_FALLTHROUGH;
6498  case 11:
6499  if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
6500  else {
6501  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 11); __PYX_ERR(0, 839, __pyx_L3_error)
6502  }
6503  CYTHON_FALLTHROUGH;
6504  case 12:
6505  if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
6506  else {
6507  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 12); __PYX_ERR(0, 839, __pyx_L3_error)
6508  }
6509  CYTHON_FALLTHROUGH;
6510  case 13:
6511  if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_orthogonalize)) != 0)) kw_args--;
6512  else {
6513  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 13); __PYX_ERR(0, 839, __pyx_L3_error)
6514  }
6515  CYTHON_FALLTHROUGH;
6516  case 14:
6517  if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_seed)) != 0)) kw_args--;
6518  else {
6519  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 14); __PYX_ERR(0, 839, __pyx_L3_error)
6520  }
6521  CYTHON_FALLTHROUGH;
6522  case 15:
6523  if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
6524  else {
6525  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, 15); __PYX_ERR(0, 839, __pyx_L3_error)
6526  }
6527  }
6528  if (unlikely(kw_args > 0)) {
6529  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_hutchinson_method_double") < 0)) __PYX_ERR(0, 839, __pyx_L3_error)
6530  }
6531  } else if (PyTuple_GET_SIZE(__pyx_args) != 16) {
6532  goto __pyx_L5_argtuple_error;
6533  } else {
6534  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6535  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6536  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6537  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6538  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6539  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6540  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
6541  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
6542  values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
6543  values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
6544  values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
6545  values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
6546  values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
6547  values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
6548  values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
6549  values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
6550  }
6551  __pyx_v_A = values[0];
6552  __pyx_v_B = values[1];
6553  __pyx_v_C = values[2];
6554  __pyx_v_gram = values[3];
6555  __pyx_v_p = values[4];
6556  __pyx_v_assume_matrix = values[5];
6557  __pyx_v_min_num_samples = values[6];
6558  __pyx_v_max_num_samples = values[7];
6559  __pyx_v_error_atol = values[8];
6560  __pyx_v_error_rtol = values[9];
6561  __pyx_v_confidence_level = values[10];
6562  __pyx_v_outlier_significance_level = values[11];
6563  __pyx_v_solver_tol = values[12];
6564  __pyx_v_orthogonalize = values[13];
6565  __pyx_v_seed = values[14];
6566  __pyx_v_num_threads = values[15];
6567  }
6568  goto __pyx_L4_argument_unpacking_done;
6569  __pyx_L5_argtuple_error:;
6570  __Pyx_RaiseArgtupleInvalid("_hutchinson_method_double", 1, 16, 16, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 839, __pyx_L3_error)
6571  __pyx_L3_error:;
6572  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._hutchinson_method_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
6573  __Pyx_RefNannyFinishContext();
6574  return NULL;
6575  __pyx_L4_argument_unpacking_done:;
6576  __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_C, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_solver_tol, __pyx_v_orthogonalize, __pyx_v_seed, __pyx_v_num_threads);
6577 
6578  /* function exit code */
6579  __Pyx_RefNannyFinishContext();
6580  return __pyx_r;
6581 }
6582 
6583 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_4_hutchinson_method_double(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_orthogonalize, PyObject *__pyx_v_seed, PyObject *__pyx_v_num_threads) {
6584  PyObject *__pyx_v_vector_size = NULL;
6585  PyObject *__pyx_v_E = NULL;
6586  __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
6587  double *__pyx_v_cE;
6588  PyObject *__pyx_v_init_tot_wall_time = NULL;
6589  PyObject *__pyx_v_init_cpu_proc_time = NULL;
6590  PyObject *__pyx_v_samples = NULL;
6591  PyObject *__pyx_v_processed_samples_indices = NULL;
6592  int __pyx_v_num_processed_samples;
6593  int __pyx_v_num_samples_used;
6594  int __pyx_v_converged;
6595  PyObject *__pyx_v_init_alg_wall_time = NULL;
6596  PyObject *__pyx_v_AtA = NULL;
6597  PyObject *__pyx_v_i = NULL;
6598  PyObject *__pyx_v_alg_wall_time = NULL;
6599  PyObject *__pyx_v_trace = NULL;
6600  PyObject *__pyx_v_error = NULL;
6601  PyObject *__pyx_v_num_outliers = NULL;
6602  PyObject *__pyx_v_tot_wall_time = NULL;
6603  PyObject *__pyx_v_cpu_proc_time = NULL;
6604  PyObject *__pyx_r = NULL;
6605  __Pyx_TraceDeclarations
6606  __Pyx_RefNannyDeclarations
6607  PyObject *__pyx_t_1 = NULL;
6608  PyObject *__pyx_t_2 = NULL;
6609  PyObject *__pyx_t_3 = NULL;
6610  PyObject *__pyx_t_4 = NULL;
6611  PyObject *__pyx_t_5 = NULL;
6612  __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6613  Py_ssize_t __pyx_t_7;
6614  Py_ssize_t __pyx_t_8;
6615  LongIndexType __pyx_t_9;
6616  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
6617  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
6618  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
6619  __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
6620  int __pyx_t_14;
6621  int __pyx_t_15;
6622  int __pyx_t_16;
6623  Py_ssize_t __pyx_t_17;
6624  PyObject *(*__pyx_t_18)(PyObject *);
6625  double __pyx_t_19;
6626  int __pyx_t_20;
6627  PyObject *__pyx_t_21 = NULL;
6628  PyObject *(*__pyx_t_22)(PyObject *);
6629  int __pyx_t_23;
6630  int __pyx_lineno = 0;
6631  const char *__pyx_filename = NULL;
6632  int __pyx_clineno = 0;
6633  __Pyx_TraceFrameInit(__pyx_codeobj__5)
6634  __Pyx_RefNannySetupContext("_hutchinson_method_double", 0);
6635  __Pyx_TraceCall("_hutchinson_method_double", __pyx_f[0], 839, 0, __PYX_ERR(0, 839, __pyx_L1_error));
6636 
6637  /* "imate/traceinv/_hutchinson_method.pyx":860
6638  * """
6639  *
6640  * vector_size = A.shape[0] # <<<<<<<<<<<<<<
6641  *
6642  * # Allocate random array with Fortran ordering (first index is contiguous)
6643  */
6644  __Pyx_TraceLine(860,0,__PYX_ERR(0, 860, __pyx_L1_error))
6645  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 860, __pyx_L1_error)
6646  __Pyx_GOTREF(__pyx_t_1);
6647  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 860, __pyx_L1_error)
6648  __Pyx_GOTREF(__pyx_t_2);
6649  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6650  __pyx_v_vector_size = __pyx_t_2;
6651  __pyx_t_2 = 0;
6652 
6653  /* "imate/traceinv/_hutchinson_method.pyx":864
6654  * # Allocate random array with Fortran ordering (first index is contiguous)
6655  * # 2D array E should be treated as a matrix, random vectors are columns of E
6656  * E = numpy.empty((vector_size, max_num_samples), dtype=numpy.float64, # <<<<<<<<<<<<<<
6657  * order='F')
6658  *
6659  */
6660  __Pyx_TraceLine(864,0,__PYX_ERR(0, 864, __pyx_L1_error))
6661  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6662  __Pyx_GOTREF(__pyx_t_2);
6663  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_empty); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 864, __pyx_L1_error)
6664  __Pyx_GOTREF(__pyx_t_1);
6665  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6666  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6667  __Pyx_GOTREF(__pyx_t_2);
6668  __Pyx_INCREF(__pyx_v_vector_size);
6669  __Pyx_GIVEREF(__pyx_v_vector_size);
6670  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_vector_size);
6671  __Pyx_INCREF(__pyx_v_max_num_samples);
6672  __Pyx_GIVEREF(__pyx_v_max_num_samples);
6673  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_max_num_samples);
6674  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 864, __pyx_L1_error)
6675  __Pyx_GOTREF(__pyx_t_3);
6676  __Pyx_GIVEREF(__pyx_t_2);
6677  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
6678  __pyx_t_2 = 0;
6679  __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 864, __pyx_L1_error)
6680  __Pyx_GOTREF(__pyx_t_2);
6681  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 864, __pyx_L1_error)
6682  __Pyx_GOTREF(__pyx_t_4);
6683  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_float64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
6684  __Pyx_GOTREF(__pyx_t_5);
6685  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6686  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 864, __pyx_L1_error)
6687  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6688  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_order, __pyx_n_u_F) < 0) __PYX_ERR(0, 864, __pyx_L1_error)
6689  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 864, __pyx_L1_error)
6690  __Pyx_GOTREF(__pyx_t_5);
6691  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6692  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6693  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6694  __pyx_v_E = __pyx_t_5;
6695  __pyx_t_5 = 0;
6696 
6697  /* "imate/traceinv/_hutchinson_method.pyx":868
6698  *
6699  * # Get c pointer to E
6700  * cdef double[::1, :] memoryview_E = E # <<<<<<<<<<<<<<
6701  * cdef double* cE = &memoryview_E[0, 0]
6702  *
6703  */
6704  __Pyx_TraceLine(868,0,__PYX_ERR(0, 868, __pyx_L1_error))
6705  __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dcd__double(__pyx_v_E, PyBUF_WRITABLE); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 868, __pyx_L1_error)
6706  __pyx_v_memoryview_E = __pyx_t_6;
6707  __pyx_t_6.memview = NULL;
6708  __pyx_t_6.data = NULL;
6709 
6710  /* "imate/traceinv/_hutchinson_method.pyx":869
6711  * # Get c pointer to E
6712  * cdef double[::1, :] memoryview_E = E
6713  * cdef double* cE = &memoryview_E[0, 0] # <<<<<<<<<<<<<<
6714  *
6715  * init_tot_wall_time = time.perf_counter()
6716  */
6717  __Pyx_TraceLine(869,0,__PYX_ERR(0, 869, __pyx_L1_error))
6718  __pyx_t_7 = 0;
6719  __pyx_t_8 = 0;
6720  __pyx_v_cE = (&(*((double *) ( /* dim=1 */ (( /* dim=0 */ ((char *) (((double *) __pyx_v_memoryview_E.data) + __pyx_t_7)) ) + __pyx_t_8 * __pyx_v_memoryview_E.strides[1]) ))));
6721 
6722  /* "imate/traceinv/_hutchinson_method.pyx":871
6723  * cdef double* cE = &memoryview_E[0, 0]
6724  *
6725  * init_tot_wall_time = time.perf_counter() # <<<<<<<<<<<<<<
6726  * init_cpu_proc_time = time.process_time()
6727  *
6728  */
6729  __Pyx_TraceLine(871,0,__PYX_ERR(0, 871, __pyx_L1_error))
6730  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error)
6731  __Pyx_GOTREF(__pyx_t_2);
6732  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 871, __pyx_L1_error)
6733  __Pyx_GOTREF(__pyx_t_3);
6734  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6735  __pyx_t_2 = NULL;
6736  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6737  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6738  if (likely(__pyx_t_2)) {
6739  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6740  __Pyx_INCREF(__pyx_t_2);
6741  __Pyx_INCREF(function);
6742  __Pyx_DECREF_SET(__pyx_t_3, function);
6743  }
6744  }
6745  __pyx_t_5 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6746  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6747  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 871, __pyx_L1_error)
6748  __Pyx_GOTREF(__pyx_t_5);
6749  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6750  __pyx_v_init_tot_wall_time = __pyx_t_5;
6751  __pyx_t_5 = 0;
6752 
6753  /* "imate/traceinv/_hutchinson_method.pyx":872
6754  *
6755  * init_tot_wall_time = time.perf_counter()
6756  * init_cpu_proc_time = time.process_time() # <<<<<<<<<<<<<<
6757  *
6758  * # Generate orthogonalized random vectors with unit norm
6759  */
6760  __Pyx_TraceLine(872,0,__PYX_ERR(0, 872, __pyx_L1_error))
6761  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_time); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 872, __pyx_L1_error)
6762  __Pyx_GOTREF(__pyx_t_3);
6763  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_process_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error)
6764  __Pyx_GOTREF(__pyx_t_2);
6765  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6766  __pyx_t_3 = NULL;
6767  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6768  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6769  if (likely(__pyx_t_3)) {
6770  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6771  __Pyx_INCREF(__pyx_t_3);
6772  __Pyx_INCREF(function);
6773  __Pyx_DECREF_SET(__pyx_t_2, function);
6774  }
6775  }
6776  __pyx_t_5 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
6777  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6778  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 872, __pyx_L1_error)
6779  __Pyx_GOTREF(__pyx_t_5);
6780  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6781  __pyx_v_init_cpu_proc_time = __pyx_t_5;
6782  __pyx_t_5 = 0;
6783 
6784  /* "imate/traceinv/_hutchinson_method.pyx":875
6785  *
6786  * # Generate orthogonalized random vectors with unit norm
6787  * generate_random_column_vectors[double](cE, vector_size, max_num_samples, # <<<<<<<<<<<<<<
6788  * int(orthogonalize), seed,
6789  * num_threads)
6790  */
6791  __Pyx_TraceLine(875,0,__PYX_ERR(0, 875, __pyx_L1_error))
6792  __pyx_t_9 = __Pyx_PyInt_As_LongIndexType(__pyx_v_vector_size); if (unlikely((__pyx_t_9 == ((LongIndexType)-1)) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
6793  __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples); if (unlikely((__pyx_t_10 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 875, __pyx_L1_error)
6794 
6795  /* "imate/traceinv/_hutchinson_method.pyx":876
6796  * # Generate orthogonalized random vectors with unit norm
6797  * generate_random_column_vectors[double](cE, vector_size, max_num_samples,
6798  * int(orthogonalize), seed, # <<<<<<<<<<<<<<
6799  * num_threads)
6800  *
6801  */
6802  __Pyx_TraceLine(876,0,__PYX_ERR(0, 876, __pyx_L1_error))
6803  __pyx_t_5 = __Pyx_PyNumber_Int(__pyx_v_orthogonalize); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 876, __pyx_L1_error)
6804  __Pyx_GOTREF(__pyx_t_5);
6805  __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error)
6806  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6807  __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_v_seed); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 876, __pyx_L1_error)
6808 
6809  /* "imate/traceinv/_hutchinson_method.pyx":877
6810  * generate_random_column_vectors[double](cE, vector_size, max_num_samples,
6811  * int(orthogonalize), seed,
6812  * num_threads) # <<<<<<<<<<<<<<
6813  *
6814  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float64)
6815  */
6816  __Pyx_TraceLine(877,0,__PYX_ERR(0, 877, __pyx_L1_error))
6817  __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_v_num_threads); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 877, __pyx_L1_error)
6818 
6819  /* "imate/traceinv/_hutchinson_method.pyx":875
6820  *
6821  * # Generate orthogonalized random vectors with unit norm
6822  * generate_random_column_vectors[double](cE, vector_size, max_num_samples, # <<<<<<<<<<<<<<
6823  * int(orthogonalize), seed,
6824  * num_threads)
6825  */
6826  __Pyx_TraceLine(875,0,__PYX_ERR(0, 875, __pyx_L1_error))
6827  __pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors(__pyx_v_cE, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13);
6828 
6829  /* "imate/traceinv/_hutchinson_method.pyx":879
6830  * num_threads)
6831  *
6832  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float64) # <<<<<<<<<<<<<<
6833  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
6834  * samples[:] = numpy.nan
6835  */
6836  __Pyx_TraceLine(879,0,__PYX_ERR(0, 879, __pyx_L1_error))
6837  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_numpy); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6838  __Pyx_GOTREF(__pyx_t_5);
6839  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 879, __pyx_L1_error)
6840  __Pyx_GOTREF(__pyx_t_2);
6841  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6842  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6843  __Pyx_GOTREF(__pyx_t_5);
6844  __Pyx_INCREF(__pyx_v_max_num_samples);
6845  __Pyx_GIVEREF(__pyx_v_max_num_samples);
6846  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_max_num_samples);
6847  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 879, __pyx_L1_error)
6848  __Pyx_GOTREF(__pyx_t_3);
6849  __Pyx_GIVEREF(__pyx_t_5);
6850  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
6851  __pyx_t_5 = 0;
6852  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 879, __pyx_L1_error)
6853  __Pyx_GOTREF(__pyx_t_5);
6854  __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_numpy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 879, __pyx_L1_error)
6855  __Pyx_GOTREF(__pyx_t_1);
6856  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_float64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
6857  __Pyx_GOTREF(__pyx_t_4);
6858  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6859  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 879, __pyx_L1_error)
6860  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6861  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 879, __pyx_L1_error)
6862  __Pyx_GOTREF(__pyx_t_4);
6863  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6864  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6865  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6866  __pyx_v_samples = __pyx_t_4;
6867  __pyx_t_4 = 0;
6868 
6869  /* "imate/traceinv/_hutchinson_method.pyx":880
6870  *
6871  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float64)
6872  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int) # <<<<<<<<<<<<<<
6873  * samples[:] = numpy.nan
6874  * cdef int num_processed_samples = 0
6875  */
6876  __Pyx_TraceLine(880,0,__PYX_ERR(0, 880, __pyx_L1_error))
6877  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6878  __Pyx_GOTREF(__pyx_t_4);
6879  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 880, __pyx_L1_error)
6880  __Pyx_GOTREF(__pyx_t_5);
6881  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6882  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6883  __Pyx_GOTREF(__pyx_t_4);
6884  __Pyx_INCREF(__pyx_v_max_num_samples);
6885  __Pyx_GIVEREF(__pyx_v_max_num_samples);
6886  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_max_num_samples);
6887  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 880, __pyx_L1_error)
6888  __Pyx_GOTREF(__pyx_t_3);
6889  __Pyx_GIVEREF(__pyx_t_4);
6890  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
6891  __pyx_t_4 = 0;
6892  __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 880, __pyx_L1_error)
6893  __Pyx_GOTREF(__pyx_t_4);
6894  if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, ((PyObject *)(&PyInt_Type))) < 0) __PYX_ERR(0, 880, __pyx_L1_error)
6895  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error)
6896  __Pyx_GOTREF(__pyx_t_2);
6897  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6898  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6899  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6900  __pyx_v_processed_samples_indices = __pyx_t_2;
6901  __pyx_t_2 = 0;
6902 
6903  /* "imate/traceinv/_hutchinson_method.pyx":881
6904  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float64)
6905  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
6906  * samples[:] = numpy.nan # <<<<<<<<<<<<<<
6907  * cdef int num_processed_samples = 0
6908  * cdef int num_samples_used = 0
6909  */
6910  __Pyx_TraceLine(881,0,__PYX_ERR(0, 881, __pyx_L1_error))
6911  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_numpy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error)
6912  __Pyx_GOTREF(__pyx_t_2);
6913  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_nan); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 881, __pyx_L1_error)
6914  __Pyx_GOTREF(__pyx_t_4);
6915  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6916  if (__Pyx_PyObject_SetSlice(__pyx_v_samples, __pyx_t_4, 0, 0, NULL, NULL, &__pyx_slice__4, 0, 0, 0) < 0) __PYX_ERR(0, 881, __pyx_L1_error)
6917  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6918 
6919  /* "imate/traceinv/_hutchinson_method.pyx":882
6920  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
6921  * samples[:] = numpy.nan
6922  * cdef int num_processed_samples = 0 # <<<<<<<<<<<<<<
6923  * cdef int num_samples_used = 0
6924  * cdef int converged = 0
6925  */
6926  __Pyx_TraceLine(882,0,__PYX_ERR(0, 882, __pyx_L1_error))
6927  __pyx_v_num_processed_samples = 0;
6928 
6929  /* "imate/traceinv/_hutchinson_method.pyx":883
6930  * samples[:] = numpy.nan
6931  * cdef int num_processed_samples = 0
6932  * cdef int num_samples_used = 0 # <<<<<<<<<<<<<<
6933  * cdef int converged = 0
6934  *
6935  */
6936  __Pyx_TraceLine(883,0,__PYX_ERR(0, 883, __pyx_L1_error))
6937  __pyx_v_num_samples_used = 0;
6938 
6939  /* "imate/traceinv/_hutchinson_method.pyx":884
6940  * cdef int num_processed_samples = 0
6941  * cdef int num_samples_used = 0
6942  * cdef int converged = 0 # <<<<<<<<<<<<<<
6943  *
6944  * init_alg_wall_time = time.perf_counter()
6945  */
6946  __Pyx_TraceLine(884,0,__PYX_ERR(0, 884, __pyx_L1_error))
6947  __pyx_v_converged = 0;
6948 
6949  /* "imate/traceinv/_hutchinson_method.pyx":886
6950  * cdef int converged = 0
6951  *
6952  * init_alg_wall_time = time.perf_counter() # <<<<<<<<<<<<<<
6953  *
6954  * # Compute Gramian matrix if needed
6955  */
6956  __Pyx_TraceLine(886,0,__PYX_ERR(0, 886, __pyx_L1_error))
6957  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 886, __pyx_L1_error)
6958  __Pyx_GOTREF(__pyx_t_2);
6959  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 886, __pyx_L1_error)
6960  __Pyx_GOTREF(__pyx_t_3);
6961  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6962  __pyx_t_2 = NULL;
6963  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6964  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6965  if (likely(__pyx_t_2)) {
6966  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6967  __Pyx_INCREF(__pyx_t_2);
6968  __Pyx_INCREF(function);
6969  __Pyx_DECREF_SET(__pyx_t_3, function);
6970  }
6971  }
6972  __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3);
6973  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6974  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 886, __pyx_L1_error)
6975  __Pyx_GOTREF(__pyx_t_4);
6976  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6977  __pyx_v_init_alg_wall_time = __pyx_t_4;
6978  __pyx_t_4 = 0;
6979 
6980  /* "imate/traceinv/_hutchinson_method.pyx":889
6981  *
6982  * # Compute Gramian matrix if needed
6983  * if gram: # <<<<<<<<<<<<<<
6984  * if (p == 1) and (B is None) and (C is None):
6985  * # This special case does not needed the computation of Gramian.
6986  */
6987  __Pyx_TraceLine(889,0,__PYX_ERR(0, 889, __pyx_L1_error))
6988  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_14 < 0)) __PYX_ERR(0, 889, __pyx_L1_error)
6989  if (__pyx_t_14) {
6990 
6991  /* "imate/traceinv/_hutchinson_method.pyx":890
6992  * # Compute Gramian matrix if needed
6993  * if gram:
6994  * if (p == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
6995  * # This special case does not needed the computation of Gramian.
6996  * AtA = None
6997  */
6998  __Pyx_TraceLine(890,0,__PYX_ERR(0, 890, __pyx_L1_error))
6999  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 890, __pyx_L1_error)
7000  __Pyx_GOTREF(__pyx_t_4);
7001  __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 890, __pyx_L1_error)
7002  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7003  if (__pyx_t_15) {
7004  } else {
7005  __pyx_t_14 = __pyx_t_15;
7006  goto __pyx_L5_bool_binop_done;
7007  }
7008  __pyx_t_15 = (__pyx_v_B == Py_None);
7009  __pyx_t_16 = (__pyx_t_15 != 0);
7010  if (__pyx_t_16) {
7011  } else {
7012  __pyx_t_14 = __pyx_t_16;
7013  goto __pyx_L5_bool_binop_done;
7014  }
7015  __pyx_t_16 = (__pyx_v_C == Py_None);
7016  __pyx_t_15 = (__pyx_t_16 != 0);
7017  __pyx_t_14 = __pyx_t_15;
7018  __pyx_L5_bool_binop_done:;
7019  if (__pyx_t_14) {
7020 
7021  /* "imate/traceinv/_hutchinson_method.pyx":892
7022  * if (p == 1) and (B is None) and (C is None):
7023  * # This special case does not needed the computation of Gramian.
7024  * AtA = None # <<<<<<<<<<<<<<
7025  * else:
7026  * AtA = A.T @ A
7027  */
7028  __Pyx_TraceLine(892,0,__PYX_ERR(0, 892, __pyx_L1_error))
7029  __Pyx_INCREF(Py_None);
7030  __pyx_v_AtA = Py_None;
7031 
7032  /* "imate/traceinv/_hutchinson_method.pyx":890
7033  * # Compute Gramian matrix if needed
7034  * if gram:
7035  * if (p == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
7036  * # This special case does not needed the computation of Gramian.
7037  * AtA = None
7038  */
7039  goto __pyx_L4;
7040  }
7041 
7042  /* "imate/traceinv/_hutchinson_method.pyx":894
7043  * AtA = None
7044  * else:
7045  * AtA = A.T @ A # <<<<<<<<<<<<<<
7046  * else:
7047  * AtA = None
7048  */
7049  __Pyx_TraceLine(894,0,__PYX_ERR(0, 894, __pyx_L1_error))
7050  /*else*/ {
7051  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 894, __pyx_L1_error)
7052  __Pyx_GOTREF(__pyx_t_4);
7053  __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_t_4, __pyx_v_A); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 894, __pyx_L1_error)
7054  __Pyx_GOTREF(__pyx_t_3);
7055  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7056  __pyx_v_AtA = __pyx_t_3;
7057  __pyx_t_3 = 0;
7058  }
7059  __pyx_L4:;
7060 
7061  /* "imate/traceinv/_hutchinson_method.pyx":889
7062  *
7063  * # Compute Gramian matrix if needed
7064  * if gram: # <<<<<<<<<<<<<<
7065  * if (p == 1) and (B is None) and (C is None):
7066  * # This special case does not needed the computation of Gramian.
7067  */
7068  goto __pyx_L3;
7069  }
7070 
7071  /* "imate/traceinv/_hutchinson_method.pyx":896
7072  * AtA = A.T @ A
7073  * else:
7074  * AtA = None # <<<<<<<<<<<<<<
7075  *
7076  * # Monte-Carlo sampling
7077  */
7078  __Pyx_TraceLine(896,0,__PYX_ERR(0, 896, __pyx_L1_error))
7079  /*else*/ {
7080  __Pyx_INCREF(Py_None);
7081  __pyx_v_AtA = Py_None;
7082  }
7083  __pyx_L3:;
7084 
7085  /* "imate/traceinv/_hutchinson_method.pyx":899
7086  *
7087  * # Monte-Carlo sampling
7088  * for i in range(max_num_samples): # <<<<<<<<<<<<<<
7089  *
7090  * if converged == 0:
7091  */
7092  __Pyx_TraceLine(899,0,__PYX_ERR(0, 899, __pyx_L1_error))
7093  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_max_num_samples); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7094  __Pyx_GOTREF(__pyx_t_3);
7095  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
7096  __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_17 = 0;
7097  __pyx_t_18 = NULL;
7098  } else {
7099  __pyx_t_17 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 899, __pyx_L1_error)
7100  __Pyx_GOTREF(__pyx_t_4);
7101  __pyx_t_18 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 899, __pyx_L1_error)
7102  }
7103  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7104  for (;;) {
7105  if (likely(!__pyx_t_18)) {
7106  if (likely(PyList_CheckExact(__pyx_t_4))) {
7107  if (__pyx_t_17 >= PyList_GET_SIZE(__pyx_t_4)) break;
7108  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7109  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
7110  #else
7111  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7112  __Pyx_GOTREF(__pyx_t_3);
7113  #endif
7114  } else {
7115  if (__pyx_t_17 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
7116  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7117  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_17); __Pyx_INCREF(__pyx_t_3); __pyx_t_17++; if (unlikely(0 < 0)) __PYX_ERR(0, 899, __pyx_L1_error)
7118  #else
7119  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_17); __pyx_t_17++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 899, __pyx_L1_error)
7120  __Pyx_GOTREF(__pyx_t_3);
7121  #endif
7122  }
7123  } else {
7124  __pyx_t_3 = __pyx_t_18(__pyx_t_4);
7125  if (unlikely(!__pyx_t_3)) {
7126  PyObject* exc_type = PyErr_Occurred();
7127  if (exc_type) {
7128  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
7129  else __PYX_ERR(0, 899, __pyx_L1_error)
7130  }
7131  break;
7132  }
7133  __Pyx_GOTREF(__pyx_t_3);
7134  }
7135  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
7136  __pyx_t_3 = 0;
7137 
7138  /* "imate/traceinv/_hutchinson_method.pyx":901
7139  * for i in range(max_num_samples):
7140  *
7141  * if converged == 0: # <<<<<<<<<<<<<<
7142  *
7143  * # Stochastic estimator of trace using the i-th column of E
7144  */
7145  __Pyx_TraceLine(901,0,__PYX_ERR(0, 901, __pyx_L1_error))
7146  __pyx_t_14 = ((__pyx_v_converged == 0) != 0);
7147  if (__pyx_t_14) {
7148 
7149  /* "imate/traceinv/_hutchinson_method.pyx":905
7150  * # Stochastic estimator of trace using the i-th column of E
7151  * samples[i] = _stochastic_trace_estimator_double(
7152  * A, AtA, B, C, E[:, i], gram, p, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
7153  *
7154  * # Store the index of processed samples
7155  */
7156  __Pyx_TraceLine(905,0,__PYX_ERR(0, 905, __pyx_L1_error))
7157  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 905, __pyx_L1_error)
7158  __Pyx_GOTREF(__pyx_t_3);
7159  __Pyx_INCREF(__pyx_slice__4);
7160  __Pyx_GIVEREF(__pyx_slice__4);
7161  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_slice__4);
7162  __Pyx_INCREF(__pyx_v_i);
7163  __Pyx_GIVEREF(__pyx_v_i);
7164  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_i);
7165  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_v_E, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 905, __pyx_L1_error)
7166  __Pyx_GOTREF(__pyx_t_2);
7167  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7168 
7169  /* "imate/traceinv/_hutchinson_method.pyx":904
7170  *
7171  * # Stochastic estimator of trace using the i-th column of E
7172  * samples[i] = _stochastic_trace_estimator_double( # <<<<<<<<<<<<<<
7173  * A, AtA, B, C, E[:, i], gram, p, assume_matrix, solver_tol)
7174  *
7175  */
7176  __Pyx_TraceLine(904,0,__PYX_ERR(0, 904, __pyx_L1_error))
7177  __pyx_t_19 = __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(__pyx_v_A, __pyx_v_AtA, __pyx_v_B, __pyx_v_C, __pyx_t_2, __pyx_v_gram, __pyx_v_p, __pyx_v_assume_matrix, __pyx_v_solver_tol); if (unlikely(__pyx_t_19 == ((double)-1) && PyErr_Occurred())) __PYX_ERR(0, 904, __pyx_L1_error)
7178  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7179  __pyx_t_2 = PyFloat_FromDouble(__pyx_t_19); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 904, __pyx_L1_error)
7180  __Pyx_GOTREF(__pyx_t_2);
7181  if (unlikely(PyObject_SetItem(__pyx_v_samples, __pyx_v_i, __pyx_t_2) < 0)) __PYX_ERR(0, 904, __pyx_L1_error)
7182  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7183 
7184  /* "imate/traceinv/_hutchinson_method.pyx":908
7185  *
7186  * # Store the index of processed samples
7187  * processed_samples_indices[num_processed_samples] = i # <<<<<<<<<<<<<<
7188  * num_processed_samples += 1
7189  *
7190  */
7191  __Pyx_TraceLine(908,0,__PYX_ERR(0, 908, __pyx_L1_error))
7192  if (unlikely(__Pyx_SetItemInt(__pyx_v_processed_samples_indices, __pyx_v_num_processed_samples, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 0) < 0)) __PYX_ERR(0, 908, __pyx_L1_error)
7193 
7194  /* "imate/traceinv/_hutchinson_method.pyx":909
7195  * # Store the index of processed samples
7196  * processed_samples_indices[num_processed_samples] = i
7197  * num_processed_samples += 1 # <<<<<<<<<<<<<<
7198  *
7199  * # Check whether convergence criterion has been met to stop.
7200  */
7201  __Pyx_TraceLine(909,0,__PYX_ERR(0, 909, __pyx_L1_error))
7202  __pyx_v_num_processed_samples = (__pyx_v_num_processed_samples + 1);
7203 
7204  /* "imate/traceinv/_hutchinson_method.pyx":914
7205  * # This check can also be done after another parallel thread
7206  * # set all_converged to "1", but we continue to update error.
7207  * converged, num_samples_used = check_convergence( # <<<<<<<<<<<<<<
7208  * samples, min_num_samples, processed_samples_indices,
7209  * num_processed_samples, confidence_level, error_atol,
7210  */
7211  __Pyx_TraceLine(914,0,__PYX_ERR(0, 914, __pyx_L1_error))
7212  __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_check_convergence); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
7213  __Pyx_GOTREF(__pyx_t_3);
7214 
7215  /* "imate/traceinv/_hutchinson_method.pyx":916
7216  * converged, num_samples_used = check_convergence(
7217  * samples, min_num_samples, processed_samples_indices,
7218  * num_processed_samples, confidence_level, error_atol, # <<<<<<<<<<<<<<
7219  * error_rtol)
7220  *
7221  */
7222  __Pyx_TraceLine(916,0,__PYX_ERR(0, 916, __pyx_L1_error))
7223  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 916, __pyx_L1_error)
7224  __Pyx_GOTREF(__pyx_t_5);
7225 
7226  /* "imate/traceinv/_hutchinson_method.pyx":917
7227  * samples, min_num_samples, processed_samples_indices,
7228  * num_processed_samples, confidence_level, error_atol,
7229  * error_rtol) # <<<<<<<<<<<<<<
7230  *
7231  * alg_wall_time = time.perf_counter() - init_alg_wall_time
7232  */
7233  __Pyx_TraceLine(917,0,__PYX_ERR(0, 917, __pyx_L1_error))
7234  __pyx_t_1 = NULL;
7235  __pyx_t_20 = 0;
7236  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7237  __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
7238  if (likely(__pyx_t_1)) {
7239  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7240  __Pyx_INCREF(__pyx_t_1);
7241  __Pyx_INCREF(function);
7242  __Pyx_DECREF_SET(__pyx_t_3, function);
7243  __pyx_t_20 = 1;
7244  }
7245  }
7246  #if CYTHON_FAST_PYCALL
7247  if (PyFunction_Check(__pyx_t_3)) {
7248  PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
7249  __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7250  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7251  __Pyx_GOTREF(__pyx_t_2);
7252  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7253  } else
7254  #endif
7255  #if CYTHON_FAST_PYCCALL
7256  if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7257  PyObject *__pyx_temp[8] = {__pyx_t_1, __pyx_v_samples, __pyx_v_min_num_samples, __pyx_v_processed_samples_indices, __pyx_t_5, __pyx_v_confidence_level, __pyx_v_error_atol, __pyx_v_error_rtol};
7258  __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_20, 7+__pyx_t_20); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7259  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7260  __Pyx_GOTREF(__pyx_t_2);
7261  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7262  } else
7263  #endif
7264  {
7265  __pyx_t_21 = PyTuple_New(7+__pyx_t_20); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 914, __pyx_L1_error)
7266  __Pyx_GOTREF(__pyx_t_21);
7267  if (__pyx_t_1) {
7268  __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); __pyx_t_1 = NULL;
7269  }
7270  __Pyx_INCREF(__pyx_v_samples);
7271  __Pyx_GIVEREF(__pyx_v_samples);
7272  PyTuple_SET_ITEM(__pyx_t_21, 0+__pyx_t_20, __pyx_v_samples);
7273  __Pyx_INCREF(__pyx_v_min_num_samples);
7274  __Pyx_GIVEREF(__pyx_v_min_num_samples);
7275  PyTuple_SET_ITEM(__pyx_t_21, 1+__pyx_t_20, __pyx_v_min_num_samples);
7276  __Pyx_INCREF(__pyx_v_processed_samples_indices);
7277  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7278  PyTuple_SET_ITEM(__pyx_t_21, 2+__pyx_t_20, __pyx_v_processed_samples_indices);
7279  __Pyx_GIVEREF(__pyx_t_5);
7280  PyTuple_SET_ITEM(__pyx_t_21, 3+__pyx_t_20, __pyx_t_5);
7281  __Pyx_INCREF(__pyx_v_confidence_level);
7282  __Pyx_GIVEREF(__pyx_v_confidence_level);
7283  PyTuple_SET_ITEM(__pyx_t_21, 4+__pyx_t_20, __pyx_v_confidence_level);
7284  __Pyx_INCREF(__pyx_v_error_atol);
7285  __Pyx_GIVEREF(__pyx_v_error_atol);
7286  PyTuple_SET_ITEM(__pyx_t_21, 5+__pyx_t_20, __pyx_v_error_atol);
7287  __Pyx_INCREF(__pyx_v_error_rtol);
7288  __Pyx_GIVEREF(__pyx_v_error_rtol);
7289  PyTuple_SET_ITEM(__pyx_t_21, 6+__pyx_t_20, __pyx_v_error_rtol);
7290  __pyx_t_5 = 0;
7291  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 914, __pyx_L1_error)
7292  __Pyx_GOTREF(__pyx_t_2);
7293  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7294  }
7295  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7296  if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) {
7297  PyObject* sequence = __pyx_t_2;
7298  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7299  if (unlikely(size != 2)) {
7300  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
7301  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7302  __PYX_ERR(0, 914, __pyx_L1_error)
7303  }
7304  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7305  if (likely(PyTuple_CheckExact(sequence))) {
7306  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
7307  __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1);
7308  } else {
7309  __pyx_t_3 = PyList_GET_ITEM(sequence, 0);
7310  __pyx_t_21 = PyList_GET_ITEM(sequence, 1);
7311  }
7312  __Pyx_INCREF(__pyx_t_3);
7313  __Pyx_INCREF(__pyx_t_21);
7314  #else
7315  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 914, __pyx_L1_error)
7316  __Pyx_GOTREF(__pyx_t_3);
7317  __pyx_t_21 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 914, __pyx_L1_error)
7318  __Pyx_GOTREF(__pyx_t_21);
7319  #endif
7320  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7321  } else {
7322  Py_ssize_t index = -1;
7323  __pyx_t_5 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 914, __pyx_L1_error)
7324  __Pyx_GOTREF(__pyx_t_5);
7325  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7326  __pyx_t_22 = Py_TYPE(__pyx_t_5)->tp_iternext;
7327  index = 0; __pyx_t_3 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L11_unpacking_failed;
7328  __Pyx_GOTREF(__pyx_t_3);
7329  index = 1; __pyx_t_21 = __pyx_t_22(__pyx_t_5); if (unlikely(!__pyx_t_21)) goto __pyx_L11_unpacking_failed;
7330  __Pyx_GOTREF(__pyx_t_21);
7331  if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_5), 2) < 0) __PYX_ERR(0, 914, __pyx_L1_error)
7332  __pyx_t_22 = NULL;
7333  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7334  goto __pyx_L12_unpacking_done;
7335  __pyx_L11_unpacking_failed:;
7336  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7337  __pyx_t_22 = NULL;
7338  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7339  __PYX_ERR(0, 914, __pyx_L1_error)
7340  __pyx_L12_unpacking_done:;
7341  }
7342 
7343  /* "imate/traceinv/_hutchinson_method.pyx":914
7344  * # This check can also be done after another parallel thread
7345  * # set all_converged to "1", but we continue to update error.
7346  * converged, num_samples_used = check_convergence( # <<<<<<<<<<<<<<
7347  * samples, min_num_samples, processed_samples_indices,
7348  * num_processed_samples, confidence_level, error_atol,
7349  */
7350  __Pyx_TraceLine(914,0,__PYX_ERR(0, 914, __pyx_L1_error))
7351  __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error)
7352  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7353  __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_23 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 914, __pyx_L1_error)
7354  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7355  __pyx_v_converged = __pyx_t_20;
7356  __pyx_v_num_samples_used = __pyx_t_23;
7357 
7358  /* "imate/traceinv/_hutchinson_method.pyx":901
7359  * for i in range(max_num_samples):
7360  *
7361  * if converged == 0: # <<<<<<<<<<<<<<
7362  *
7363  * # Stochastic estimator of trace using the i-th column of E
7364  */
7365  }
7366 
7367  /* "imate/traceinv/_hutchinson_method.pyx":899
7368  *
7369  * # Monte-Carlo sampling
7370  * for i in range(max_num_samples): # <<<<<<<<<<<<<<
7371  *
7372  * if converged == 0:
7373  */
7374  __Pyx_TraceLine(899,0,__PYX_ERR(0, 899, __pyx_L1_error))
7375  }
7376  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7377 
7378  /* "imate/traceinv/_hutchinson_method.pyx":919
7379  * error_rtol)
7380  *
7381  * alg_wall_time = time.perf_counter() - init_alg_wall_time # <<<<<<<<<<<<<<
7382  *
7383  * trace, error, num_outliers = average_estimates(
7384  */
7385  __Pyx_TraceLine(919,0,__PYX_ERR(0, 919, __pyx_L1_error))
7386  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 919, __pyx_L1_error)
7387  __Pyx_GOTREF(__pyx_t_2);
7388  __pyx_t_21 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 919, __pyx_L1_error)
7389  __Pyx_GOTREF(__pyx_t_21);
7390  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7391  __pyx_t_2 = NULL;
7392  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) {
7393  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_21);
7394  if (likely(__pyx_t_2)) {
7395  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21);
7396  __Pyx_INCREF(__pyx_t_2);
7397  __Pyx_INCREF(function);
7398  __Pyx_DECREF_SET(__pyx_t_21, function);
7399  }
7400  }
7401  __pyx_t_4 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_21);
7402  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7403  if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 919, __pyx_L1_error)
7404  __Pyx_GOTREF(__pyx_t_4);
7405  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7406  __pyx_t_21 = PyNumber_Subtract(__pyx_t_4, __pyx_v_init_alg_wall_time); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 919, __pyx_L1_error)
7407  __Pyx_GOTREF(__pyx_t_21);
7408  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7409  __pyx_v_alg_wall_time = __pyx_t_21;
7410  __pyx_t_21 = 0;
7411 
7412  /* "imate/traceinv/_hutchinson_method.pyx":921
7413  * alg_wall_time = time.perf_counter() - init_alg_wall_time
7414  *
7415  * trace, error, num_outliers = average_estimates( # <<<<<<<<<<<<<<
7416  * confidence_level, outlier_significance_level, max_num_samples,
7417  * num_samples_used, processed_samples_indices, samples)
7418  */
7419  __Pyx_TraceLine(921,0,__PYX_ERR(0, 921, __pyx_L1_error))
7420  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_average_estimates); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L1_error)
7421  __Pyx_GOTREF(__pyx_t_4);
7422 
7423  /* "imate/traceinv/_hutchinson_method.pyx":923
7424  * trace, error, num_outliers = average_estimates(
7425  * confidence_level, outlier_significance_level, max_num_samples,
7426  * num_samples_used, processed_samples_indices, samples) # <<<<<<<<<<<<<<
7427  *
7428  * tot_wall_time = time.perf_counter() - init_tot_wall_time
7429  */
7430  __Pyx_TraceLine(923,0,__PYX_ERR(0, 923, __pyx_L1_error))
7431  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 923, __pyx_L1_error)
7432  __Pyx_GOTREF(__pyx_t_2);
7433  __pyx_t_3 = NULL;
7434  __pyx_t_23 = 0;
7435  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
7436  __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
7437  if (likely(__pyx_t_3)) {
7438  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
7439  __Pyx_INCREF(__pyx_t_3);
7440  __Pyx_INCREF(function);
7441  __Pyx_DECREF_SET(__pyx_t_4, function);
7442  __pyx_t_23 = 1;
7443  }
7444  }
7445  #if CYTHON_FAST_PYCALL
7446  if (PyFunction_Check(__pyx_t_4)) {
7447  PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
7448  __pyx_t_21 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7449  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7450  __Pyx_GOTREF(__pyx_t_21);
7451  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7452  } else
7453  #endif
7454  #if CYTHON_FAST_PYCCALL
7455  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
7456  PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_max_num_samples, __pyx_t_2, __pyx_v_processed_samples_indices, __pyx_v_samples};
7457  __pyx_t_21 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_23, 6+__pyx_t_23); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7458  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7459  __Pyx_GOTREF(__pyx_t_21);
7460  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7461  } else
7462  #endif
7463  {
7464  __pyx_t_5 = PyTuple_New(6+__pyx_t_23); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error)
7465  __Pyx_GOTREF(__pyx_t_5);
7466  if (__pyx_t_3) {
7467  __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
7468  }
7469  __Pyx_INCREF(__pyx_v_confidence_level);
7470  __Pyx_GIVEREF(__pyx_v_confidence_level);
7471  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_23, __pyx_v_confidence_level);
7472  __Pyx_INCREF(__pyx_v_outlier_significance_level);
7473  __Pyx_GIVEREF(__pyx_v_outlier_significance_level);
7474  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_23, __pyx_v_outlier_significance_level);
7475  __Pyx_INCREF(__pyx_v_max_num_samples);
7476  __Pyx_GIVEREF(__pyx_v_max_num_samples);
7477  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_23, __pyx_v_max_num_samples);
7478  __Pyx_GIVEREF(__pyx_t_2);
7479  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_23, __pyx_t_2);
7480  __Pyx_INCREF(__pyx_v_processed_samples_indices);
7481  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7482  PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_23, __pyx_v_processed_samples_indices);
7483  __Pyx_INCREF(__pyx_v_samples);
7484  __Pyx_GIVEREF(__pyx_v_samples);
7485  PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_23, __pyx_v_samples);
7486  __pyx_t_2 = 0;
7487  __pyx_t_21 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 921, __pyx_L1_error)
7488  __Pyx_GOTREF(__pyx_t_21);
7489  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7490  }
7491  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7492  if ((likely(PyTuple_CheckExact(__pyx_t_21))) || (PyList_CheckExact(__pyx_t_21))) {
7493  PyObject* sequence = __pyx_t_21;
7494  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
7495  if (unlikely(size != 3)) {
7496  if (size > 3) __Pyx_RaiseTooManyValuesError(3);
7497  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
7498  __PYX_ERR(0, 921, __pyx_L1_error)
7499  }
7500  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
7501  if (likely(PyTuple_CheckExact(sequence))) {
7502  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
7503  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
7504  __pyx_t_2 = PyTuple_GET_ITEM(sequence, 2);
7505  } else {
7506  __pyx_t_4 = PyList_GET_ITEM(sequence, 0);
7507  __pyx_t_5 = PyList_GET_ITEM(sequence, 1);
7508  __pyx_t_2 = PyList_GET_ITEM(sequence, 2);
7509  }
7510  __Pyx_INCREF(__pyx_t_4);
7511  __Pyx_INCREF(__pyx_t_5);
7512  __Pyx_INCREF(__pyx_t_2);
7513  #else
7514  __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 921, __pyx_L1_error)
7515  __Pyx_GOTREF(__pyx_t_4);
7516  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 921, __pyx_L1_error)
7517  __Pyx_GOTREF(__pyx_t_5);
7518  __pyx_t_2 = PySequence_ITEM(sequence, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 921, __pyx_L1_error)
7519  __Pyx_GOTREF(__pyx_t_2);
7520  #endif
7521  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7522  } else {
7523  Py_ssize_t index = -1;
7524  __pyx_t_3 = PyObject_GetIter(__pyx_t_21); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 921, __pyx_L1_error)
7525  __Pyx_GOTREF(__pyx_t_3);
7526  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7527  __pyx_t_22 = Py_TYPE(__pyx_t_3)->tp_iternext;
7528  index = 0; __pyx_t_4 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_4)) goto __pyx_L13_unpacking_failed;
7529  __Pyx_GOTREF(__pyx_t_4);
7530  index = 1; __pyx_t_5 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
7531  __Pyx_GOTREF(__pyx_t_5);
7532  index = 2; __pyx_t_2 = __pyx_t_22(__pyx_t_3); if (unlikely(!__pyx_t_2)) goto __pyx_L13_unpacking_failed;
7533  __Pyx_GOTREF(__pyx_t_2);
7534  if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_3), 3) < 0) __PYX_ERR(0, 921, __pyx_L1_error)
7535  __pyx_t_22 = NULL;
7536  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7537  goto __pyx_L14_unpacking_done;
7538  __pyx_L13_unpacking_failed:;
7539  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7540  __pyx_t_22 = NULL;
7541  if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
7542  __PYX_ERR(0, 921, __pyx_L1_error)
7543  __pyx_L14_unpacking_done:;
7544  }
7545 
7546  /* "imate/traceinv/_hutchinson_method.pyx":921
7547  * alg_wall_time = time.perf_counter() - init_alg_wall_time
7548  *
7549  * trace, error, num_outliers = average_estimates( # <<<<<<<<<<<<<<
7550  * confidence_level, outlier_significance_level, max_num_samples,
7551  * num_samples_used, processed_samples_indices, samples)
7552  */
7553  __Pyx_TraceLine(921,0,__PYX_ERR(0, 921, __pyx_L1_error))
7554  __pyx_v_trace = __pyx_t_4;
7555  __pyx_t_4 = 0;
7556  __pyx_v_error = __pyx_t_5;
7557  __pyx_t_5 = 0;
7558  __pyx_v_num_outliers = __pyx_t_2;
7559  __pyx_t_2 = 0;
7560 
7561  /* "imate/traceinv/_hutchinson_method.pyx":925
7562  * num_samples_used, processed_samples_indices, samples)
7563  *
7564  * tot_wall_time = time.perf_counter() - init_tot_wall_time # <<<<<<<<<<<<<<
7565  * cpu_proc_time = time.process_time() - init_cpu_proc_time
7566  *
7567  */
7568  __Pyx_TraceLine(925,0,__PYX_ERR(0, 925, __pyx_L1_error))
7569  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 925, __pyx_L1_error)
7570  __Pyx_GOTREF(__pyx_t_2);
7571  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_perf_counter); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
7572  __Pyx_GOTREF(__pyx_t_5);
7573  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7574  __pyx_t_2 = NULL;
7575  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7576  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
7577  if (likely(__pyx_t_2)) {
7578  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7579  __Pyx_INCREF(__pyx_t_2);
7580  __Pyx_INCREF(function);
7581  __Pyx_DECREF_SET(__pyx_t_5, function);
7582  }
7583  }
7584  __pyx_t_21 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_5);
7585  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7586  if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 925, __pyx_L1_error)
7587  __Pyx_GOTREF(__pyx_t_21);
7588  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7589  __pyx_t_5 = PyNumber_Subtract(__pyx_t_21, __pyx_v_init_tot_wall_time); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 925, __pyx_L1_error)
7590  __Pyx_GOTREF(__pyx_t_5);
7591  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7592  __pyx_v_tot_wall_time = __pyx_t_5;
7593  __pyx_t_5 = 0;
7594 
7595  /* "imate/traceinv/_hutchinson_method.pyx":926
7596  *
7597  * tot_wall_time = time.perf_counter() - init_tot_wall_time
7598  * cpu_proc_time = time.process_time() - init_cpu_proc_time # <<<<<<<<<<<<<<
7599  *
7600  * return trace, error, num_outliers, samples, processed_samples_indices, \
7601  */
7602  __Pyx_TraceLine(926,0,__PYX_ERR(0, 926, __pyx_L1_error))
7603  __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_time); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 926, __pyx_L1_error)
7604  __Pyx_GOTREF(__pyx_t_21);
7605  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_21, __pyx_n_s_process_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
7606  __Pyx_GOTREF(__pyx_t_2);
7607  __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
7608  __pyx_t_21 = NULL;
7609  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
7610  __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_2);
7611  if (likely(__pyx_t_21)) {
7612  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
7613  __Pyx_INCREF(__pyx_t_21);
7614  __Pyx_INCREF(function);
7615  __Pyx_DECREF_SET(__pyx_t_2, function);
7616  }
7617  }
7618  __pyx_t_5 = (__pyx_t_21) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_21) : __Pyx_PyObject_CallNoArg(__pyx_t_2);
7619  __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0;
7620  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 926, __pyx_L1_error)
7621  __Pyx_GOTREF(__pyx_t_5);
7622  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7623  __pyx_t_2 = PyNumber_Subtract(__pyx_t_5, __pyx_v_init_cpu_proc_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 926, __pyx_L1_error)
7624  __Pyx_GOTREF(__pyx_t_2);
7625  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7626  __pyx_v_cpu_proc_time = __pyx_t_2;
7627  __pyx_t_2 = 0;
7628 
7629  /* "imate/traceinv/_hutchinson_method.pyx":928
7630  * cpu_proc_time = time.process_time() - init_cpu_proc_time
7631  *
7632  * return trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
7633  * num_processed_samples, num_samples_used, converged, tot_wall_time, \
7634  * alg_wall_time, cpu_proc_time
7635  */
7636  __Pyx_TraceLine(928,0,__PYX_ERR(0, 928, __pyx_L1_error))
7637  __Pyx_XDECREF(__pyx_r);
7638 
7639  /* "imate/traceinv/_hutchinson_method.pyx":929
7640  *
7641  * return trace, error, num_outliers, samples, processed_samples_indices, \
7642  * num_processed_samples, num_samples_used, converged, tot_wall_time, \ # <<<<<<<<<<<<<<
7643  * alg_wall_time, cpu_proc_time
7644  *
7645  */
7646  __Pyx_TraceLine(929,0,__PYX_ERR(0, 929, __pyx_L1_error))
7647  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_num_processed_samples); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 929, __pyx_L1_error)
7648  __Pyx_GOTREF(__pyx_t_2);
7649  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_num_samples_used); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 929, __pyx_L1_error)
7650  __Pyx_GOTREF(__pyx_t_5);
7651  __pyx_t_21 = __Pyx_PyInt_From_int(__pyx_v_converged); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 929, __pyx_L1_error)
7652  __Pyx_GOTREF(__pyx_t_21);
7653 
7654  /* "imate/traceinv/_hutchinson_method.pyx":928
7655  * cpu_proc_time = time.process_time() - init_cpu_proc_time
7656  *
7657  * return trace, error, num_outliers, samples, processed_samples_indices, \ # <<<<<<<<<<<<<<
7658  * num_processed_samples, num_samples_used, converged, tot_wall_time, \
7659  * alg_wall_time, cpu_proc_time
7660  */
7661  __Pyx_TraceLine(928,0,__PYX_ERR(0, 928, __pyx_L1_error))
7662  __pyx_t_4 = PyTuple_New(11); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 928, __pyx_L1_error)
7663  __Pyx_GOTREF(__pyx_t_4);
7664  __Pyx_INCREF(__pyx_v_trace);
7665  __Pyx_GIVEREF(__pyx_v_trace);
7666  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_trace);
7667  __Pyx_INCREF(__pyx_v_error);
7668  __Pyx_GIVEREF(__pyx_v_error);
7669  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_error);
7670  __Pyx_INCREF(__pyx_v_num_outliers);
7671  __Pyx_GIVEREF(__pyx_v_num_outliers);
7672  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_v_num_outliers);
7673  __Pyx_INCREF(__pyx_v_samples);
7674  __Pyx_GIVEREF(__pyx_v_samples);
7675  PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_v_samples);
7676  __Pyx_INCREF(__pyx_v_processed_samples_indices);
7677  __Pyx_GIVEREF(__pyx_v_processed_samples_indices);
7678  PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_v_processed_samples_indices);
7679  __Pyx_GIVEREF(__pyx_t_2);
7680  PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_2);
7681  __Pyx_GIVEREF(__pyx_t_5);
7682  PyTuple_SET_ITEM(__pyx_t_4, 6, __pyx_t_5);
7683  __Pyx_GIVEREF(__pyx_t_21);
7684  PyTuple_SET_ITEM(__pyx_t_4, 7, __pyx_t_21);
7685  __Pyx_INCREF(__pyx_v_tot_wall_time);
7686  __Pyx_GIVEREF(__pyx_v_tot_wall_time);
7687  PyTuple_SET_ITEM(__pyx_t_4, 8, __pyx_v_tot_wall_time);
7688  __Pyx_INCREF(__pyx_v_alg_wall_time);
7689  __Pyx_GIVEREF(__pyx_v_alg_wall_time);
7690  PyTuple_SET_ITEM(__pyx_t_4, 9, __pyx_v_alg_wall_time);
7691  __Pyx_INCREF(__pyx_v_cpu_proc_time);
7692  __Pyx_GIVEREF(__pyx_v_cpu_proc_time);
7693  PyTuple_SET_ITEM(__pyx_t_4, 10, __pyx_v_cpu_proc_time);
7694  __pyx_t_2 = 0;
7695  __pyx_t_5 = 0;
7696  __pyx_t_21 = 0;
7697  __pyx_r = __pyx_t_4;
7698  __pyx_t_4 = 0;
7699  goto __pyx_L0;
7700 
7701  /* "imate/traceinv/_hutchinson_method.pyx":839
7702  * # ========================
7703  *
7704  * def _hutchinson_method_double( # <<<<<<<<<<<<<<
7705  * A,
7706  * B,
7707  */
7708 
7709  /* function exit code */
7710  __pyx_L1_error:;
7711  __Pyx_XDECREF(__pyx_t_1);
7712  __Pyx_XDECREF(__pyx_t_2);
7713  __Pyx_XDECREF(__pyx_t_3);
7714  __Pyx_XDECREF(__pyx_t_4);
7715  __Pyx_XDECREF(__pyx_t_5);
7716  __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
7717  __Pyx_XDECREF(__pyx_t_21);
7718  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._hutchinson_method_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
7719  __pyx_r = NULL;
7720  __pyx_L0:;
7721  __Pyx_XDECREF(__pyx_v_vector_size);
7722  __Pyx_XDECREF(__pyx_v_E);
7723  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
7724  __Pyx_XDECREF(__pyx_v_init_tot_wall_time);
7725  __Pyx_XDECREF(__pyx_v_init_cpu_proc_time);
7726  __Pyx_XDECREF(__pyx_v_samples);
7727  __Pyx_XDECREF(__pyx_v_processed_samples_indices);
7728  __Pyx_XDECREF(__pyx_v_init_alg_wall_time);
7729  __Pyx_XDECREF(__pyx_v_AtA);
7730  __Pyx_XDECREF(__pyx_v_i);
7731  __Pyx_XDECREF(__pyx_v_alg_wall_time);
7732  __Pyx_XDECREF(__pyx_v_trace);
7733  __Pyx_XDECREF(__pyx_v_error);
7734  __Pyx_XDECREF(__pyx_v_num_outliers);
7735  __Pyx_XDECREF(__pyx_v_tot_wall_time);
7736  __Pyx_XDECREF(__pyx_v_cpu_proc_time);
7737  __Pyx_XGIVEREF(__pyx_r);
7738  __Pyx_TraceReturn(__pyx_r, 0);
7739  __Pyx_RefNannyFinishContext();
7740  return __pyx_r;
7741 }
7742 
7743 /* "imate/traceinv/_hutchinson_method.pyx":937
7744  * # ================================
7745  *
7746  * cdef float _stochastic_trace_estimator_float( # <<<<<<<<<<<<<<
7747  * A,
7748  * AtA,
7749  */
7750 
7751 static float __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_float(PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_E, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol) {
7752  PyObject *__pyx_v_OpE = NULL;
7753  __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
7754  float *__pyx_v_cE;
7755  __Pyx_memviewslice __pyx_v_memoryview_OpE = { 0, 0, { 0 }, { 0 }, { 0 } };
7756  float *__pyx_v_cOpE;
7757  int __pyx_v_vector_size;
7758  float __pyx_v_inner_prod;
7759  float __pyx_v_trace_estimate;
7760  float __pyx_r;
7761  __Pyx_TraceDeclarations
7762  __Pyx_RefNannyDeclarations
7763  int __pyx_t_1;
7764  int __pyx_t_2;
7765  int __pyx_t_3;
7766  PyObject *__pyx_t_4 = NULL;
7767  PyObject *__pyx_t_5 = NULL;
7768  PyObject *__pyx_t_6 = NULL;
7769  int __pyx_t_7;
7770  PyObject *__pyx_t_8 = NULL;
7771  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
7772  Py_ssize_t __pyx_t_10;
7773  int __pyx_lineno = 0;
7774  const char *__pyx_filename = NULL;
7775  int __pyx_clineno = 0;
7776  __Pyx_RefNannySetupContext("_stochastic_trace_estimator_float", 0);
7777  __Pyx_TraceCall("_stochastic_trace_estimator_float", __pyx_f[0], 937, 0, __PYX_ERR(0, 937, __pyx_L1_error));
7778 
7779  /* "imate/traceinv/_hutchinson_method.pyx":976
7780  *
7781  * # Check AtA is not None when AtA is needed
7782  * if gram and (AtA is None): # <<<<<<<<<<<<<<
7783  * if not ((p == 1) and (B is None) and (C is None)):
7784  * raise RuntimeError('"AtA" cannot be None.')
7785  */
7786  __Pyx_TraceLine(976,0,__PYX_ERR(0, 976, __pyx_L1_error))
7787  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 976, __pyx_L1_error)
7788  if (__pyx_t_2) {
7789  } else {
7790  __pyx_t_1 = __pyx_t_2;
7791  goto __pyx_L4_bool_binop_done;
7792  }
7793  __pyx_t_2 = (__pyx_v_AtA == Py_None);
7794  __pyx_t_3 = (__pyx_t_2 != 0);
7795  __pyx_t_1 = __pyx_t_3;
7796  __pyx_L4_bool_binop_done:;
7797  if (__pyx_t_1) {
7798 
7799  /* "imate/traceinv/_hutchinson_method.pyx":977
7800  * # Check AtA is not None when AtA is needed
7801  * if gram and (AtA is None):
7802  * if not ((p == 1) and (B is None) and (C is None)): # <<<<<<<<<<<<<<
7803  * raise RuntimeError('"AtA" cannot be None.')
7804  *
7805  */
7806  __Pyx_TraceLine(977,0,__PYX_ERR(0, 977, __pyx_L1_error))
7807  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 977, __pyx_L1_error)
7808  __Pyx_GOTREF(__pyx_t_4);
7809  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 977, __pyx_L1_error)
7810  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7811  if (__pyx_t_3) {
7812  } else {
7813  __pyx_t_1 = __pyx_t_3;
7814  goto __pyx_L7_bool_binop_done;
7815  }
7816  __pyx_t_3 = (__pyx_v_B == Py_None);
7817  __pyx_t_2 = (__pyx_t_3 != 0);
7818  if (__pyx_t_2) {
7819  } else {
7820  __pyx_t_1 = __pyx_t_2;
7821  goto __pyx_L7_bool_binop_done;
7822  }
7823  __pyx_t_2 = (__pyx_v_C == Py_None);
7824  __pyx_t_3 = (__pyx_t_2 != 0);
7825  __pyx_t_1 = __pyx_t_3;
7826  __pyx_L7_bool_binop_done:;
7827  __pyx_t_3 = ((!__pyx_t_1) != 0);
7828  if (unlikely(__pyx_t_3)) {
7829 
7830  /* "imate/traceinv/_hutchinson_method.pyx":978
7831  * if gram and (AtA is None):
7832  * if not ((p == 1) and (B is None) and (C is None)):
7833  * raise RuntimeError('"AtA" cannot be None.') # <<<<<<<<<<<<<<
7834  *
7835  * # Multiply operator * B * E
7836  */
7837  __Pyx_TraceLine(978,0,__PYX_ERR(0, 978, __pyx_L1_error))
7838  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 978, __pyx_L1_error)
7839  __Pyx_GOTREF(__pyx_t_4);
7840  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
7841  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7842  __PYX_ERR(0, 978, __pyx_L1_error)
7843 
7844  /* "imate/traceinv/_hutchinson_method.pyx":977
7845  * # Check AtA is not None when AtA is needed
7846  * if gram and (AtA is None):
7847  * if not ((p == 1) and (B is None) and (C is None)): # <<<<<<<<<<<<<<
7848  * raise RuntimeError('"AtA" cannot be None.')
7849  *
7850  */
7851  }
7852 
7853  /* "imate/traceinv/_hutchinson_method.pyx":976
7854  *
7855  * # Check AtA is not None when AtA is needed
7856  * if gram and (AtA is None): # <<<<<<<<<<<<<<
7857  * if not ((p == 1) and (B is None) and (C is None)):
7858  * raise RuntimeError('"AtA" cannot be None.')
7859  */
7860  }
7861 
7862  /* "imate/traceinv/_hutchinson_method.pyx":981
7863  *
7864  * # Multiply operator * B * E
7865  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E) # <<<<<<<<<<<<<<
7866  *
7867  * # Multiply operator * C * OpE
7868  */
7869  __Pyx_TraceLine(981,0,__PYX_ERR(0, 981, __pyx_L1_error))
7870  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 981, __pyx_L1_error)
7871  __Pyx_GOTREF(__pyx_t_5);
7872  __pyx_t_6 = NULL;
7873  __pyx_t_7 = 0;
7874  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7875  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
7876  if (likely(__pyx_t_6)) {
7877  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7878  __Pyx_INCREF(__pyx_t_6);
7879  __Pyx_INCREF(function);
7880  __Pyx_DECREF_SET(__pyx_t_5, function);
7881  __pyx_t_7 = 1;
7882  }
7883  }
7884  #if CYTHON_FAST_PYCALL
7885  if (PyFunction_Check(__pyx_t_5)) {
7886  PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
7887  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7888  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7889  __Pyx_GOTREF(__pyx_t_4);
7890  } else
7891  #endif
7892  #if CYTHON_FAST_PYCCALL
7893  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7894  PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
7895  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7896  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7897  __Pyx_GOTREF(__pyx_t_4);
7898  } else
7899  #endif
7900  {
7901  __pyx_t_8 = PyTuple_New(8+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 981, __pyx_L1_error)
7902  __Pyx_GOTREF(__pyx_t_8);
7903  if (__pyx_t_6) {
7904  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
7905  }
7906  __Pyx_INCREF(__pyx_v_A);
7907  __Pyx_GIVEREF(__pyx_v_A);
7908  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
7909  __Pyx_INCREF(__pyx_v_AtA);
7910  __Pyx_GIVEREF(__pyx_v_AtA);
7911  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_AtA);
7912  __Pyx_INCREF(__pyx_v_p);
7913  __Pyx_GIVEREF(__pyx_v_p);
7914  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_p);
7915  __Pyx_INCREF(__pyx_v_gram);
7916  __Pyx_GIVEREF(__pyx_v_gram);
7917  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_gram);
7918  __Pyx_INCREF(__pyx_v_assume_matrix);
7919  __Pyx_GIVEREF(__pyx_v_assume_matrix);
7920  PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_assume_matrix);
7921  __Pyx_INCREF(__pyx_v_solver_tol);
7922  __Pyx_GIVEREF(__pyx_v_solver_tol);
7923  PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_solver_tol);
7924  __Pyx_INCREF(__pyx_v_B);
7925  __Pyx_GIVEREF(__pyx_v_B);
7926  PyTuple_SET_ITEM(__pyx_t_8, 6+__pyx_t_7, __pyx_v_B);
7927  __Pyx_INCREF(__pyx_v_E);
7928  __Pyx_GIVEREF(__pyx_v_E);
7929  PyTuple_SET_ITEM(__pyx_t_8, 7+__pyx_t_7, __pyx_v_E);
7930  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 981, __pyx_L1_error)
7931  __Pyx_GOTREF(__pyx_t_4);
7932  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7933  }
7934  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7935  __pyx_v_OpE = __pyx_t_4;
7936  __pyx_t_4 = 0;
7937 
7938  /* "imate/traceinv/_hutchinson_method.pyx":984
7939  *
7940  * # Multiply operator * C * OpE
7941  * if C is not None: # <<<<<<<<<<<<<<
7942  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE)
7943  *
7944  */
7945  __Pyx_TraceLine(984,0,__PYX_ERR(0, 984, __pyx_L1_error))
7946  __pyx_t_3 = (__pyx_v_C != Py_None);
7947  __pyx_t_1 = (__pyx_t_3 != 0);
7948  if (__pyx_t_1) {
7949 
7950  /* "imate/traceinv/_hutchinson_method.pyx":985
7951  * # Multiply operator * C * OpE
7952  * if C is not None:
7953  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE) # <<<<<<<<<<<<<<
7954  *
7955  * # Get c pointer to E
7956  */
7957  __Pyx_TraceLine(985,0,__PYX_ERR(0, 985, __pyx_L1_error))
7958  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 985, __pyx_L1_error)
7959  __Pyx_GOTREF(__pyx_t_5);
7960  __pyx_t_8 = NULL;
7961  __pyx_t_7 = 0;
7962  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7963  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
7964  if (likely(__pyx_t_8)) {
7965  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7966  __Pyx_INCREF(__pyx_t_8);
7967  __Pyx_INCREF(function);
7968  __Pyx_DECREF_SET(__pyx_t_5, function);
7969  __pyx_t_7 = 1;
7970  }
7971  }
7972  #if CYTHON_FAST_PYCALL
7973  if (PyFunction_Check(__pyx_t_5)) {
7974  PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
7975  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
7976  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7977  __Pyx_GOTREF(__pyx_t_4);
7978  } else
7979  #endif
7980  #if CYTHON_FAST_PYCCALL
7981  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7982  PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
7983  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
7984  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
7985  __Pyx_GOTREF(__pyx_t_4);
7986  } else
7987  #endif
7988  {
7989  __pyx_t_6 = PyTuple_New(8+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 985, __pyx_L1_error)
7990  __Pyx_GOTREF(__pyx_t_6);
7991  if (__pyx_t_8) {
7992  __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
7993  }
7994  __Pyx_INCREF(__pyx_v_A);
7995  __Pyx_GIVEREF(__pyx_v_A);
7996  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_A);
7997  __Pyx_INCREF(__pyx_v_AtA);
7998  __Pyx_GIVEREF(__pyx_v_AtA);
7999  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_AtA);
8000  __Pyx_INCREF(__pyx_v_p);
8001  __Pyx_GIVEREF(__pyx_v_p);
8002  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_p);
8003  __Pyx_INCREF(__pyx_v_gram);
8004  __Pyx_GIVEREF(__pyx_v_gram);
8005  PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_gram);
8006  __Pyx_INCREF(__pyx_v_assume_matrix);
8007  __Pyx_GIVEREF(__pyx_v_assume_matrix);
8008  PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_assume_matrix);
8009  __Pyx_INCREF(__pyx_v_solver_tol);
8010  __Pyx_GIVEREF(__pyx_v_solver_tol);
8011  PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_solver_tol);
8012  __Pyx_INCREF(__pyx_v_C);
8013  __Pyx_GIVEREF(__pyx_v_C);
8014  PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_7, __pyx_v_C);
8015  __Pyx_INCREF(__pyx_v_OpE);
8016  __Pyx_GIVEREF(__pyx_v_OpE);
8017  PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_7, __pyx_v_OpE);
8018  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 985, __pyx_L1_error)
8019  __Pyx_GOTREF(__pyx_t_4);
8020  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8021  }
8022  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8023  __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
8024  __pyx_t_4 = 0;
8025 
8026  /* "imate/traceinv/_hutchinson_method.pyx":984
8027  *
8028  * # Multiply operator * C * OpE
8029  * if C is not None: # <<<<<<<<<<<<<<
8030  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE)
8031  *
8032  */
8033  }
8034 
8035  /* "imate/traceinv/_hutchinson_method.pyx":988
8036  *
8037  * # Get c pointer to E
8038  * cdef float[:] memoryview_E = E # <<<<<<<<<<<<<<
8039  * cdef float* cE = &memoryview_E[0]
8040  *
8041  */
8042  __Pyx_TraceLine(988,0,__PYX_ERR(0, 988, __pyx_L1_error))
8043  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_E, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 988, __pyx_L1_error)
8044  __pyx_v_memoryview_E = __pyx_t_9;
8045  __pyx_t_9.memview = NULL;
8046  __pyx_t_9.data = NULL;
8047 
8048  /* "imate/traceinv/_hutchinson_method.pyx":989
8049  * # Get c pointer to E
8050  * cdef float[:] memoryview_E = E
8051  * cdef float* cE = &memoryview_E[0] # <<<<<<<<<<<<<<
8052  *
8053  * # Get c pointer to OpE.
8054  */
8055  __Pyx_TraceLine(989,0,__PYX_ERR(0, 989, __pyx_L1_error))
8056  __pyx_t_10 = 0;
8057  __pyx_v_cE = (&(*((float *) ( /* dim=0 */ (__pyx_v_memoryview_E.data + __pyx_t_10 * __pyx_v_memoryview_E.strides[0]) ))));
8058 
8059  /* "imate/traceinv/_hutchinson_method.pyx":992
8060  *
8061  * # Get c pointer to OpE.
8062  * cdef float[:] memoryview_OpE = OpE # <<<<<<<<<<<<<<
8063  * cdef float* cOpE = &memoryview_OpE[0]
8064  *
8065  */
8066  __Pyx_TraceLine(992,0,__PYX_ERR(0, 992, __pyx_L1_error))
8067  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_OpE, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 992, __pyx_L1_error)
8068  __pyx_v_memoryview_OpE = __pyx_t_9;
8069  __pyx_t_9.memview = NULL;
8070  __pyx_t_9.data = NULL;
8071 
8072  /* "imate/traceinv/_hutchinson_method.pyx":993
8073  * # Get c pointer to OpE.
8074  * cdef float[:] memoryview_OpE = OpE
8075  * cdef float* cOpE = &memoryview_OpE[0] # <<<<<<<<<<<<<<
8076  *
8077  * # Inner product of E and OpE
8078  */
8079  __Pyx_TraceLine(993,0,__PYX_ERR(0, 993, __pyx_L1_error))
8080  __pyx_t_10 = 0;
8081  __pyx_v_cOpE = (&(*((float *) ( /* dim=0 */ (__pyx_v_memoryview_OpE.data + __pyx_t_10 * __pyx_v_memoryview_OpE.strides[0]) ))));
8082 
8083  /* "imate/traceinv/_hutchinson_method.pyx":996
8084  *
8085  * # Inner product of E and OpE
8086  * cdef int vector_size = A.shape[0] # <<<<<<<<<<<<<<
8087  * cdef float inner_prod
8088  *
8089  */
8090  __Pyx_TraceLine(996,0,__PYX_ERR(0, 996, __pyx_L1_error))
8091  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 996, __pyx_L1_error)
8092  __Pyx_GOTREF(__pyx_t_4);
8093  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 996, __pyx_L1_error)
8094  __Pyx_GOTREF(__pyx_t_5);
8095  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8096  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 996, __pyx_L1_error)
8097  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8098  __pyx_v_vector_size = __pyx_t_7;
8099 
8100  /* "imate/traceinv/_hutchinson_method.pyx":999
8101  * cdef float inner_prod
8102  *
8103  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
8104  * inner_prod = cVectorOperations[float].inner_product(cOpE, cOpE,
8105  * vector_size)
8106  */
8107  __Pyx_TraceLine(999,0,__PYX_ERR(0, 999, __pyx_L1_error))
8108  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 999, __pyx_L1_error)
8109  if (__pyx_t_3) {
8110  } else {
8111  __pyx_t_1 = __pyx_t_3;
8112  goto __pyx_L12_bool_binop_done;
8113  }
8114  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 999, __pyx_L1_error)
8115  __Pyx_GOTREF(__pyx_t_4);
8116  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 999, __pyx_L1_error)
8117  __Pyx_GOTREF(__pyx_t_6);
8118  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8119  __pyx_t_4 = NULL;
8120  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8121  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8122  if (likely(__pyx_t_4)) {
8123  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8124  __Pyx_INCREF(__pyx_t_4);
8125  __Pyx_INCREF(function);
8126  __Pyx_DECREF_SET(__pyx_t_6, function);
8127  }
8128  }
8129  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_p);
8130  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8131  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 999, __pyx_L1_error)
8132  __Pyx_GOTREF(__pyx_t_5);
8133  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8134  __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 999, __pyx_L1_error)
8135  __Pyx_GOTREF(__pyx_t_6);
8136  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8137  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 999, __pyx_L1_error)
8138  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8139  if (__pyx_t_3) {
8140  } else {
8141  __pyx_t_1 = __pyx_t_3;
8142  goto __pyx_L12_bool_binop_done;
8143  }
8144  __pyx_t_3 = (__pyx_v_B == Py_None);
8145  __pyx_t_2 = (__pyx_t_3 != 0);
8146  if (__pyx_t_2) {
8147  } else {
8148  __pyx_t_1 = __pyx_t_2;
8149  goto __pyx_L12_bool_binop_done;
8150  }
8151  __pyx_t_2 = (__pyx_v_C == Py_None);
8152  __pyx_t_3 = (__pyx_t_2 != 0);
8153  __pyx_t_1 = __pyx_t_3;
8154  __pyx_L12_bool_binop_done:;
8155  if (__pyx_t_1) {
8156 
8157  /* "imate/traceinv/_hutchinson_method.pyx":1000
8158  *
8159  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None):
8160  * inner_prod = cVectorOperations[float].inner_product(cOpE, cOpE, # <<<<<<<<<<<<<<
8161  * vector_size)
8162  * else:
8163  */
8164  __Pyx_TraceLine(1000,0,__PYX_ERR(0, 1000, __pyx_L1_error))
8165  __pyx_v_inner_prod = cVectorOperations<float> ::inner_product(__pyx_v_cOpE, __pyx_v_cOpE, __pyx_v_vector_size);
8166 
8167  /* "imate/traceinv/_hutchinson_method.pyx":999
8168  * cdef float inner_prod
8169  *
8170  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
8171  * inner_prod = cVectorOperations[float].inner_product(cOpE, cOpE,
8172  * vector_size)
8173  */
8174  goto __pyx_L11;
8175  }
8176 
8177  /* "imate/traceinv/_hutchinson_method.pyx":1003
8178  * vector_size)
8179  * else:
8180  * inner_prod = cVectorOperations[float].inner_product(cE, cOpE, # <<<<<<<<<<<<<<
8181  * vector_size)
8182  *
8183  */
8184  __Pyx_TraceLine(1003,0,__PYX_ERR(0, 1003, __pyx_L1_error))
8185  /*else*/ {
8186 
8187  /* "imate/traceinv/_hutchinson_method.pyx":1004
8188  * else:
8189  * inner_prod = cVectorOperations[float].inner_product(cE, cOpE,
8190  * vector_size) # <<<<<<<<<<<<<<
8191  *
8192  * # Hutcinson trace estimate
8193  */
8194  __Pyx_TraceLine(1004,0,__PYX_ERR(0, 1004, __pyx_L1_error))
8195  __pyx_v_inner_prod = cVectorOperations<float> ::inner_product(__pyx_v_cE, __pyx_v_cOpE, __pyx_v_vector_size);
8196  }
8197  __pyx_L11:;
8198 
8199  /* "imate/traceinv/_hutchinson_method.pyx":1007
8200  *
8201  * # Hutcinson trace estimate
8202  * cdef float trace_estimate = vector_size * inner_prod # <<<<<<<<<<<<<<
8203  *
8204  * return trace_estimate
8205  */
8206  __Pyx_TraceLine(1007,0,__PYX_ERR(0, 1007, __pyx_L1_error))
8207  __pyx_v_trace_estimate = (__pyx_v_vector_size * __pyx_v_inner_prod);
8208 
8209  /* "imate/traceinv/_hutchinson_method.pyx":1009
8210  * cdef float trace_estimate = vector_size * inner_prod
8211  *
8212  * return trace_estimate # <<<<<<<<<<<<<<
8213  *
8214  *
8215  */
8216  __Pyx_TraceLine(1009,0,__PYX_ERR(0, 1009, __pyx_L1_error))
8217  __pyx_r = __pyx_v_trace_estimate;
8218  goto __pyx_L0;
8219 
8220  /* "imate/traceinv/_hutchinson_method.pyx":937
8221  * # ================================
8222  *
8223  * cdef float _stochastic_trace_estimator_float( # <<<<<<<<<<<<<<
8224  * A,
8225  * AtA,
8226  */
8227 
8228  /* function exit code */
8229  __pyx_L1_error:;
8230  __Pyx_XDECREF(__pyx_t_4);
8231  __Pyx_XDECREF(__pyx_t_5);
8232  __Pyx_XDECREF(__pyx_t_6);
8233  __Pyx_XDECREF(__pyx_t_8);
8234  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
8235  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._stochastic_trace_estimator_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
8236  __pyx_r = -1;
8237  __pyx_L0:;
8238  __Pyx_XDECREF(__pyx_v_OpE);
8239  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
8240  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_OpE, 1);
8241  __Pyx_TraceReturn(Py_None, 0);
8242  __Pyx_RefNannyFinishContext();
8243  return __pyx_r;
8244 }
8245 
8246 /* "imate/traceinv/_hutchinson_method.pyx":1016
8247  * # =================================
8248  *
8249  * cdef double _stochastic_trace_estimator_double( # <<<<<<<<<<<<<<
8250  * A,
8251  * AtA,
8252  */
8253 
8254 static double __pyx_f_5imate_8traceinv_18_hutchinson_method__stochastic_trace_estimator_double(PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_B, PyObject *__pyx_v_C, PyObject *__pyx_v_E, PyObject *__pyx_v_gram, PyObject *__pyx_v_p, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol) {
8255  PyObject *__pyx_v_OpE = NULL;
8256  __Pyx_memviewslice __pyx_v_memoryview_E = { 0, 0, { 0 }, { 0 }, { 0 } };
8257  double *__pyx_v_cE;
8258  __Pyx_memviewslice __pyx_v_memoryview_OpE = { 0, 0, { 0 }, { 0 }, { 0 } };
8259  double *__pyx_v_cOpE;
8260  int __pyx_v_vector_size;
8261  double __pyx_v_inner_prod;
8262  double __pyx_v_trace_estimate;
8263  double __pyx_r;
8264  __Pyx_TraceDeclarations
8265  __Pyx_RefNannyDeclarations
8266  int __pyx_t_1;
8267  int __pyx_t_2;
8268  int __pyx_t_3;
8269  PyObject *__pyx_t_4 = NULL;
8270  PyObject *__pyx_t_5 = NULL;
8271  PyObject *__pyx_t_6 = NULL;
8272  int __pyx_t_7;
8273  PyObject *__pyx_t_8 = NULL;
8274  __Pyx_memviewslice __pyx_t_9 = { 0, 0, { 0 }, { 0 }, { 0 } };
8275  Py_ssize_t __pyx_t_10;
8276  int __pyx_lineno = 0;
8277  const char *__pyx_filename = NULL;
8278  int __pyx_clineno = 0;
8279  __Pyx_RefNannySetupContext("_stochastic_trace_estimator_double", 0);
8280  __Pyx_TraceCall("_stochastic_trace_estimator_double", __pyx_f[0], 1016, 0, __PYX_ERR(0, 1016, __pyx_L1_error));
8281 
8282  /* "imate/traceinv/_hutchinson_method.pyx":1055
8283  *
8284  * # Check AtA is not None when AtA is needed
8285  * if gram and (AtA is None): # <<<<<<<<<<<<<<
8286  * if not ((p == 1) and (B is None) and (C is None)):
8287  * raise RuntimeError('"AtA" cannot be None.')
8288  */
8289  __Pyx_TraceLine(1055,0,__PYX_ERR(0, 1055, __pyx_L1_error))
8290  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1055, __pyx_L1_error)
8291  if (__pyx_t_2) {
8292  } else {
8293  __pyx_t_1 = __pyx_t_2;
8294  goto __pyx_L4_bool_binop_done;
8295  }
8296  __pyx_t_2 = (__pyx_v_AtA == Py_None);
8297  __pyx_t_3 = (__pyx_t_2 != 0);
8298  __pyx_t_1 = __pyx_t_3;
8299  __pyx_L4_bool_binop_done:;
8300  if (__pyx_t_1) {
8301 
8302  /* "imate/traceinv/_hutchinson_method.pyx":1056
8303  * # Check AtA is not None when AtA is needed
8304  * if gram and (AtA is None):
8305  * if not ((p == 1) and (B is None) and (C is None)): # <<<<<<<<<<<<<<
8306  * raise RuntimeError('"AtA" cannot be None.')
8307  *
8308  */
8309  __Pyx_TraceLine(1056,0,__PYX_ERR(0, 1056, __pyx_L1_error))
8310  __pyx_t_4 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1056, __pyx_L1_error)
8311  __Pyx_GOTREF(__pyx_t_4);
8312  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1056, __pyx_L1_error)
8313  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8314  if (__pyx_t_3) {
8315  } else {
8316  __pyx_t_1 = __pyx_t_3;
8317  goto __pyx_L7_bool_binop_done;
8318  }
8319  __pyx_t_3 = (__pyx_v_B == Py_None);
8320  __pyx_t_2 = (__pyx_t_3 != 0);
8321  if (__pyx_t_2) {
8322  } else {
8323  __pyx_t_1 = __pyx_t_2;
8324  goto __pyx_L7_bool_binop_done;
8325  }
8326  __pyx_t_2 = (__pyx_v_C == Py_None);
8327  __pyx_t_3 = (__pyx_t_2 != 0);
8328  __pyx_t_1 = __pyx_t_3;
8329  __pyx_L7_bool_binop_done:;
8330  __pyx_t_3 = ((!__pyx_t_1) != 0);
8331  if (unlikely(__pyx_t_3)) {
8332 
8333  /* "imate/traceinv/_hutchinson_method.pyx":1057
8334  * if gram and (AtA is None):
8335  * if not ((p == 1) and (B is None) and (C is None)):
8336  * raise RuntimeError('"AtA" cannot be None.') # <<<<<<<<<<<<<<
8337  *
8338  * # Multiply operator * B * E
8339  */
8340  __Pyx_TraceLine(1057,0,__PYX_ERR(0, 1057, __pyx_L1_error))
8341  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1057, __pyx_L1_error)
8342  __Pyx_GOTREF(__pyx_t_4);
8343  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
8344  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8345  __PYX_ERR(0, 1057, __pyx_L1_error)
8346 
8347  /* "imate/traceinv/_hutchinson_method.pyx":1056
8348  * # Check AtA is not None when AtA is needed
8349  * if gram and (AtA is None):
8350  * if not ((p == 1) and (B is None) and (C is None)): # <<<<<<<<<<<<<<
8351  * raise RuntimeError('"AtA" cannot be None.')
8352  *
8353  */
8354  }
8355 
8356  /* "imate/traceinv/_hutchinson_method.pyx":1055
8357  *
8358  * # Check AtA is not None when AtA is needed
8359  * if gram and (AtA is None): # <<<<<<<<<<<<<<
8360  * if not ((p == 1) and (B is None) and (C is None)):
8361  * raise RuntimeError('"AtA" cannot be None.')
8362  */
8363  }
8364 
8365  /* "imate/traceinv/_hutchinson_method.pyx":1060
8366  *
8367  * # Multiply operator * B * E
8368  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E) # <<<<<<<<<<<<<<
8369  *
8370  * # Multiply operator * C * OpE
8371  */
8372  __Pyx_TraceLine(1060,0,__PYX_ERR(0, 1060, __pyx_L1_error))
8373  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1060, __pyx_L1_error)
8374  __Pyx_GOTREF(__pyx_t_5);
8375  __pyx_t_6 = NULL;
8376  __pyx_t_7 = 0;
8377  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8378  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8379  if (likely(__pyx_t_6)) {
8380  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8381  __Pyx_INCREF(__pyx_t_6);
8382  __Pyx_INCREF(function);
8383  __Pyx_DECREF_SET(__pyx_t_5, function);
8384  __pyx_t_7 = 1;
8385  }
8386  }
8387  #if CYTHON_FAST_PYCALL
8388  if (PyFunction_Check(__pyx_t_5)) {
8389  PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
8390  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8391  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8392  __Pyx_GOTREF(__pyx_t_4);
8393  } else
8394  #endif
8395  #if CYTHON_FAST_PYCCALL
8396  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8397  PyObject *__pyx_temp[9] = {__pyx_t_6, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E};
8398  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8399  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8400  __Pyx_GOTREF(__pyx_t_4);
8401  } else
8402  #endif
8403  {
8404  __pyx_t_8 = PyTuple_New(8+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1060, __pyx_L1_error)
8405  __Pyx_GOTREF(__pyx_t_8);
8406  if (__pyx_t_6) {
8407  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
8408  }
8409  __Pyx_INCREF(__pyx_v_A);
8410  __Pyx_GIVEREF(__pyx_v_A);
8411  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
8412  __Pyx_INCREF(__pyx_v_AtA);
8413  __Pyx_GIVEREF(__pyx_v_AtA);
8414  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_AtA);
8415  __Pyx_INCREF(__pyx_v_p);
8416  __Pyx_GIVEREF(__pyx_v_p);
8417  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_p);
8418  __Pyx_INCREF(__pyx_v_gram);
8419  __Pyx_GIVEREF(__pyx_v_gram);
8420  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_gram);
8421  __Pyx_INCREF(__pyx_v_assume_matrix);
8422  __Pyx_GIVEREF(__pyx_v_assume_matrix);
8423  PyTuple_SET_ITEM(__pyx_t_8, 4+__pyx_t_7, __pyx_v_assume_matrix);
8424  __Pyx_INCREF(__pyx_v_solver_tol);
8425  __Pyx_GIVEREF(__pyx_v_solver_tol);
8426  PyTuple_SET_ITEM(__pyx_t_8, 5+__pyx_t_7, __pyx_v_solver_tol);
8427  __Pyx_INCREF(__pyx_v_B);
8428  __Pyx_GIVEREF(__pyx_v_B);
8429  PyTuple_SET_ITEM(__pyx_t_8, 6+__pyx_t_7, __pyx_v_B);
8430  __Pyx_INCREF(__pyx_v_E);
8431  __Pyx_GIVEREF(__pyx_v_E);
8432  PyTuple_SET_ITEM(__pyx_t_8, 7+__pyx_t_7, __pyx_v_E);
8433  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1060, __pyx_L1_error)
8434  __Pyx_GOTREF(__pyx_t_4);
8435  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
8436  }
8437  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8438  __pyx_v_OpE = __pyx_t_4;
8439  __pyx_t_4 = 0;
8440 
8441  /* "imate/traceinv/_hutchinson_method.pyx":1063
8442  *
8443  * # Multiply operator * C * OpE
8444  * if C is not None: # <<<<<<<<<<<<<<
8445  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE)
8446  *
8447  */
8448  __Pyx_TraceLine(1063,0,__PYX_ERR(0, 1063, __pyx_L1_error))
8449  __pyx_t_3 = (__pyx_v_C != Py_None);
8450  __pyx_t_1 = (__pyx_t_3 != 0);
8451  if (__pyx_t_1) {
8452 
8453  /* "imate/traceinv/_hutchinson_method.pyx":1064
8454  * # Multiply operator * C * OpE
8455  * if C is not None:
8456  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE) # <<<<<<<<<<<<<<
8457  *
8458  * # Get c pointer to E
8459  */
8460  __Pyx_TraceLine(1064,0,__PYX_ERR(0, 1064, __pyx_L1_error))
8461  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_operator_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1064, __pyx_L1_error)
8462  __Pyx_GOTREF(__pyx_t_5);
8463  __pyx_t_8 = NULL;
8464  __pyx_t_7 = 0;
8465  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
8466  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
8467  if (likely(__pyx_t_8)) {
8468  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
8469  __Pyx_INCREF(__pyx_t_8);
8470  __Pyx_INCREF(function);
8471  __Pyx_DECREF_SET(__pyx_t_5, function);
8472  __pyx_t_7 = 1;
8473  }
8474  }
8475  #if CYTHON_FAST_PYCALL
8476  if (PyFunction_Check(__pyx_t_5)) {
8477  PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
8478  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8479  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8480  __Pyx_GOTREF(__pyx_t_4);
8481  } else
8482  #endif
8483  #if CYTHON_FAST_PYCCALL
8484  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
8485  PyObject *__pyx_temp[9] = {__pyx_t_8, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_C, __pyx_v_OpE};
8486  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 8+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8487  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
8488  __Pyx_GOTREF(__pyx_t_4);
8489  } else
8490  #endif
8491  {
8492  __pyx_t_6 = PyTuple_New(8+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1064, __pyx_L1_error)
8493  __Pyx_GOTREF(__pyx_t_6);
8494  if (__pyx_t_8) {
8495  __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __pyx_t_8 = NULL;
8496  }
8497  __Pyx_INCREF(__pyx_v_A);
8498  __Pyx_GIVEREF(__pyx_v_A);
8499  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_A);
8500  __Pyx_INCREF(__pyx_v_AtA);
8501  __Pyx_GIVEREF(__pyx_v_AtA);
8502  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_AtA);
8503  __Pyx_INCREF(__pyx_v_p);
8504  __Pyx_GIVEREF(__pyx_v_p);
8505  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_p);
8506  __Pyx_INCREF(__pyx_v_gram);
8507  __Pyx_GIVEREF(__pyx_v_gram);
8508  PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_gram);
8509  __Pyx_INCREF(__pyx_v_assume_matrix);
8510  __Pyx_GIVEREF(__pyx_v_assume_matrix);
8511  PyTuple_SET_ITEM(__pyx_t_6, 4+__pyx_t_7, __pyx_v_assume_matrix);
8512  __Pyx_INCREF(__pyx_v_solver_tol);
8513  __Pyx_GIVEREF(__pyx_v_solver_tol);
8514  PyTuple_SET_ITEM(__pyx_t_6, 5+__pyx_t_7, __pyx_v_solver_tol);
8515  __Pyx_INCREF(__pyx_v_C);
8516  __Pyx_GIVEREF(__pyx_v_C);
8517  PyTuple_SET_ITEM(__pyx_t_6, 6+__pyx_t_7, __pyx_v_C);
8518  __Pyx_INCREF(__pyx_v_OpE);
8519  __Pyx_GIVEREF(__pyx_v_OpE);
8520  PyTuple_SET_ITEM(__pyx_t_6, 7+__pyx_t_7, __pyx_v_OpE);
8521  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1064, __pyx_L1_error)
8522  __Pyx_GOTREF(__pyx_t_4);
8523  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8524  }
8525  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8526  __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
8527  __pyx_t_4 = 0;
8528 
8529  /* "imate/traceinv/_hutchinson_method.pyx":1063
8530  *
8531  * # Multiply operator * C * OpE
8532  * if C is not None: # <<<<<<<<<<<<<<
8533  * OpE = _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, C, OpE)
8534  *
8535  */
8536  }
8537 
8538  /* "imate/traceinv/_hutchinson_method.pyx":1067
8539  *
8540  * # Get c pointer to E
8541  * cdef double[:] memoryview_E = E # <<<<<<<<<<<<<<
8542  * cdef double* cE = &memoryview_E[0]
8543  *
8544  */
8545  __Pyx_TraceLine(1067,0,__PYX_ERR(0, 1067, __pyx_L1_error))
8546  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_E, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1067, __pyx_L1_error)
8547  __pyx_v_memoryview_E = __pyx_t_9;
8548  __pyx_t_9.memview = NULL;
8549  __pyx_t_9.data = NULL;
8550 
8551  /* "imate/traceinv/_hutchinson_method.pyx":1068
8552  * # Get c pointer to E
8553  * cdef double[:] memoryview_E = E
8554  * cdef double* cE = &memoryview_E[0] # <<<<<<<<<<<<<<
8555  *
8556  * # Get c pointer to OpE.
8557  */
8558  __Pyx_TraceLine(1068,0,__PYX_ERR(0, 1068, __pyx_L1_error))
8559  __pyx_t_10 = 0;
8560  __pyx_v_cE = (&(*((double *) ( /* dim=0 */ (__pyx_v_memoryview_E.data + __pyx_t_10 * __pyx_v_memoryview_E.strides[0]) ))));
8561 
8562  /* "imate/traceinv/_hutchinson_method.pyx":1071
8563  *
8564  * # Get c pointer to OpE.
8565  * cdef double[:] memoryview_OpE = OpE # <<<<<<<<<<<<<<
8566  * cdef double* cOpE = &memoryview_OpE[0]
8567  *
8568  */
8569  __Pyx_TraceLine(1071,0,__PYX_ERR(0, 1071, __pyx_L1_error))
8570  __pyx_t_9 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_OpE, PyBUF_WRITABLE); if (unlikely(!__pyx_t_9.memview)) __PYX_ERR(0, 1071, __pyx_L1_error)
8571  __pyx_v_memoryview_OpE = __pyx_t_9;
8572  __pyx_t_9.memview = NULL;
8573  __pyx_t_9.data = NULL;
8574 
8575  /* "imate/traceinv/_hutchinson_method.pyx":1072
8576  * # Get c pointer to OpE.
8577  * cdef double[:] memoryview_OpE = OpE
8578  * cdef double* cOpE = &memoryview_OpE[0] # <<<<<<<<<<<<<<
8579  *
8580  * # Inner product of E and OpE
8581  */
8582  __Pyx_TraceLine(1072,0,__PYX_ERR(0, 1072, __pyx_L1_error))
8583  __pyx_t_10 = 0;
8584  __pyx_v_cOpE = (&(*((double *) ( /* dim=0 */ (__pyx_v_memoryview_OpE.data + __pyx_t_10 * __pyx_v_memoryview_OpE.strides[0]) ))));
8585 
8586  /* "imate/traceinv/_hutchinson_method.pyx":1075
8587  *
8588  * # Inner product of E and OpE
8589  * cdef int vector_size = A.shape[0] # <<<<<<<<<<<<<<
8590  * cdef double inner_prod
8591  *
8592  */
8593  __Pyx_TraceLine(1075,0,__PYX_ERR(0, 1075, __pyx_L1_error))
8594  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1075, __pyx_L1_error)
8595  __Pyx_GOTREF(__pyx_t_4);
8596  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1075, __pyx_L1_error)
8597  __Pyx_GOTREF(__pyx_t_5);
8598  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8599  __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1075, __pyx_L1_error)
8600  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8601  __pyx_v_vector_size = __pyx_t_7;
8602 
8603  /* "imate/traceinv/_hutchinson_method.pyx":1078
8604  * cdef double inner_prod
8605  *
8606  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
8607  * inner_prod = cVectorOperations[double].inner_product(cOpE, cOpE,
8608  * vector_size)
8609  */
8610  __Pyx_TraceLine(1078,0,__PYX_ERR(0, 1078, __pyx_L1_error))
8611  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
8612  if (__pyx_t_3) {
8613  } else {
8614  __pyx_t_1 = __pyx_t_3;
8615  goto __pyx_L12_bool_binop_done;
8616  }
8617  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1078, __pyx_L1_error)
8618  __Pyx_GOTREF(__pyx_t_4);
8619  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1078, __pyx_L1_error)
8620  __Pyx_GOTREF(__pyx_t_6);
8621  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8622  __pyx_t_4 = NULL;
8623  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) {
8624  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
8625  if (likely(__pyx_t_4)) {
8626  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
8627  __Pyx_INCREF(__pyx_t_4);
8628  __Pyx_INCREF(function);
8629  __Pyx_DECREF_SET(__pyx_t_6, function);
8630  }
8631  }
8632  __pyx_t_5 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_p);
8633  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8634  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1078, __pyx_L1_error)
8635  __Pyx_GOTREF(__pyx_t_5);
8636  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8637  __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1078, __pyx_L1_error)
8638  __Pyx_GOTREF(__pyx_t_6);
8639  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8640  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 1078, __pyx_L1_error)
8641  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8642  if (__pyx_t_3) {
8643  } else {
8644  __pyx_t_1 = __pyx_t_3;
8645  goto __pyx_L12_bool_binop_done;
8646  }
8647  __pyx_t_3 = (__pyx_v_B == Py_None);
8648  __pyx_t_2 = (__pyx_t_3 != 0);
8649  if (__pyx_t_2) {
8650  } else {
8651  __pyx_t_1 = __pyx_t_2;
8652  goto __pyx_L12_bool_binop_done;
8653  }
8654  __pyx_t_2 = (__pyx_v_C == Py_None);
8655  __pyx_t_3 = (__pyx_t_2 != 0);
8656  __pyx_t_1 = __pyx_t_3;
8657  __pyx_L12_bool_binop_done:;
8658  if (__pyx_t_1) {
8659 
8660  /* "imate/traceinv/_hutchinson_method.pyx":1079
8661  *
8662  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None):
8663  * inner_prod = cVectorOperations[double].inner_product(cOpE, cOpE, # <<<<<<<<<<<<<<
8664  * vector_size)
8665  * else:
8666  */
8667  __Pyx_TraceLine(1079,0,__PYX_ERR(0, 1079, __pyx_L1_error))
8668  __pyx_v_inner_prod = cVectorOperations<double> ::inner_product(__pyx_v_cOpE, __pyx_v_cOpE, __pyx_v_vector_size);
8669 
8670  /* "imate/traceinv/_hutchinson_method.pyx":1078
8671  * cdef double inner_prod
8672  *
8673  * if gram and (numpy.abs(p) == 1) and (B is None) and (C is None): # <<<<<<<<<<<<<<
8674  * inner_prod = cVectorOperations[double].inner_product(cOpE, cOpE,
8675  * vector_size)
8676  */
8677  goto __pyx_L11;
8678  }
8679 
8680  /* "imate/traceinv/_hutchinson_method.pyx":1082
8681  * vector_size)
8682  * else:
8683  * inner_prod = cVectorOperations[double].inner_product(cE, cOpE, # <<<<<<<<<<<<<<
8684  * vector_size)
8685  *
8686  */
8687  __Pyx_TraceLine(1082,0,__PYX_ERR(0, 1082, __pyx_L1_error))
8688  /*else*/ {
8689 
8690  /* "imate/traceinv/_hutchinson_method.pyx":1083
8691  * else:
8692  * inner_prod = cVectorOperations[double].inner_product(cE, cOpE,
8693  * vector_size) # <<<<<<<<<<<<<<
8694  *
8695  * # Hutcinson trace estimate
8696  */
8697  __Pyx_TraceLine(1083,0,__PYX_ERR(0, 1083, __pyx_L1_error))
8698  __pyx_v_inner_prod = cVectorOperations<double> ::inner_product(__pyx_v_cE, __pyx_v_cOpE, __pyx_v_vector_size);
8699  }
8700  __pyx_L11:;
8701 
8702  /* "imate/traceinv/_hutchinson_method.pyx":1086
8703  *
8704  * # Hutcinson trace estimate
8705  * cdef double trace_estimate = vector_size * inner_prod # <<<<<<<<<<<<<<
8706  *
8707  * return trace_estimate
8708  */
8709  __Pyx_TraceLine(1086,0,__PYX_ERR(0, 1086, __pyx_L1_error))
8710  __pyx_v_trace_estimate = (__pyx_v_vector_size * __pyx_v_inner_prod);
8711 
8712  /* "imate/traceinv/_hutchinson_method.pyx":1088
8713  * cdef double trace_estimate = vector_size * inner_prod
8714  *
8715  * return trace_estimate # <<<<<<<<<<<<<<
8716  *
8717  *
8718  */
8719  __Pyx_TraceLine(1088,0,__PYX_ERR(0, 1088, __pyx_L1_error))
8720  __pyx_r = __pyx_v_trace_estimate;
8721  goto __pyx_L0;
8722 
8723  /* "imate/traceinv/_hutchinson_method.pyx":1016
8724  * # =================================
8725  *
8726  * cdef double _stochastic_trace_estimator_double( # <<<<<<<<<<<<<<
8727  * A,
8728  * AtA,
8729  */
8730 
8731  /* function exit code */
8732  __pyx_L1_error:;
8733  __Pyx_XDECREF(__pyx_t_4);
8734  __Pyx_XDECREF(__pyx_t_5);
8735  __Pyx_XDECREF(__pyx_t_6);
8736  __Pyx_XDECREF(__pyx_t_8);
8737  __PYX_XDEC_MEMVIEW(&__pyx_t_9, 1);
8738  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._stochastic_trace_estimator_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
8739  __pyx_r = -1;
8740  __pyx_L0:;
8741  __Pyx_XDECREF(__pyx_v_OpE);
8742  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_E, 1);
8743  __PYX_XDEC_MEMVIEW(&__pyx_v_memoryview_OpE, 1);
8744  __Pyx_TraceReturn(Py_None, 0);
8745  __Pyx_RefNannyFinishContext();
8746  return __pyx_r;
8747 }
8748 
8749 /* "imate/traceinv/_hutchinson_method.pyx":1095
8750  * # ============
8751  *
8752  * def _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E): # <<<<<<<<<<<<<<
8753  * """
8754  * Computes either of the followings:
8755  */
8756 
8757 /* Python wrapper */
8758 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
8759 static char __pyx_doc_5imate_8traceinv_18_hutchinson_method_6_operator_dot[] = "_operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E)\n\n Computes either of the followings:\n\n * Ainv * B * E\n * (Ainv ** p) * B * E\n * AtA * B * E\n * (AtA ** p) * B * E\n ";
8760 static PyMethodDef __pyx_mdef_5imate_8traceinv_18_hutchinson_method_7_operator_dot = {"_operator_dot", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_8traceinv_18_hutchinson_method_6_operator_dot};
8761 static PyObject *__pyx_pw_5imate_8traceinv_18_hutchinson_method_7_operator_dot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8762  PyObject *__pyx_v_A = 0;
8763  PyObject *__pyx_v_AtA = 0;
8764  PyObject *__pyx_v_p = 0;
8765  PyObject *__pyx_v_gram = 0;
8766  PyObject *__pyx_v_assume_matrix = 0;
8767  PyObject *__pyx_v_solver_tol = 0;
8768  PyObject *__pyx_v_B = 0;
8769  PyObject *__pyx_v_E = 0;
8770  int __pyx_lineno = 0;
8771  const char *__pyx_filename = NULL;
8772  int __pyx_clineno = 0;
8773  PyObject *__pyx_r = 0;
8774  __Pyx_RefNannyDeclarations
8775  __Pyx_RefNannySetupContext("_operator_dot (wrapper)", 0);
8776  {
8777  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_AtA,&__pyx_n_s_p,&__pyx_n_s_gram,&__pyx_n_s_assume_matrix,&__pyx_n_s_solver_tol,&__pyx_n_s_B,&__pyx_n_s_E,0};
8778  PyObject* values[8] = {0,0,0,0,0,0,0,0};
8779  if (unlikely(__pyx_kwds)) {
8780  Py_ssize_t kw_args;
8781  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8782  switch (pos_args) {
8783  case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8784  CYTHON_FALLTHROUGH;
8785  case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8786  CYTHON_FALLTHROUGH;
8787  case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8788  CYTHON_FALLTHROUGH;
8789  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8790  CYTHON_FALLTHROUGH;
8791  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8792  CYTHON_FALLTHROUGH;
8793  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8794  CYTHON_FALLTHROUGH;
8795  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8796  CYTHON_FALLTHROUGH;
8797  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8798  CYTHON_FALLTHROUGH;
8799  case 0: break;
8800  default: goto __pyx_L5_argtuple_error;
8801  }
8802  kw_args = PyDict_Size(__pyx_kwds);
8803  switch (pos_args) {
8804  case 0:
8805  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
8806  else goto __pyx_L5_argtuple_error;
8807  CYTHON_FALLTHROUGH;
8808  case 1:
8809  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_AtA)) != 0)) kw_args--;
8810  else {
8811  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 1); __PYX_ERR(0, 1095, __pyx_L3_error)
8812  }
8813  CYTHON_FALLTHROUGH;
8814  case 2:
8815  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_p)) != 0)) kw_args--;
8816  else {
8817  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 2); __PYX_ERR(0, 1095, __pyx_L3_error)
8818  }
8819  CYTHON_FALLTHROUGH;
8820  case 3:
8821  if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_gram)) != 0)) kw_args--;
8822  else {
8823  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 3); __PYX_ERR(0, 1095, __pyx_L3_error)
8824  }
8825  CYTHON_FALLTHROUGH;
8826  case 4:
8827  if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_assume_matrix)) != 0)) kw_args--;
8828  else {
8829  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 4); __PYX_ERR(0, 1095, __pyx_L3_error)
8830  }
8831  CYTHON_FALLTHROUGH;
8832  case 5:
8833  if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_solver_tol)) != 0)) kw_args--;
8834  else {
8835  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 5); __PYX_ERR(0, 1095, __pyx_L3_error)
8836  }
8837  CYTHON_FALLTHROUGH;
8838  case 6:
8839  if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_B)) != 0)) kw_args--;
8840  else {
8841  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 6); __PYX_ERR(0, 1095, __pyx_L3_error)
8842  }
8843  CYTHON_FALLTHROUGH;
8844  case 7:
8845  if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_E)) != 0)) kw_args--;
8846  else {
8847  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, 7); __PYX_ERR(0, 1095, __pyx_L3_error)
8848  }
8849  }
8850  if (unlikely(kw_args > 0)) {
8851  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_operator_dot") < 0)) __PYX_ERR(0, 1095, __pyx_L3_error)
8852  }
8853  } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
8854  goto __pyx_L5_argtuple_error;
8855  } else {
8856  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8857  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8858  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8859  values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8860  values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8861  values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
8862  values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
8863  values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
8864  }
8865  __pyx_v_A = values[0];
8866  __pyx_v_AtA = values[1];
8867  __pyx_v_p = values[2];
8868  __pyx_v_gram = values[3];
8869  __pyx_v_assume_matrix = values[4];
8870  __pyx_v_solver_tol = values[5];
8871  __pyx_v_B = values[6];
8872  __pyx_v_E = values[7];
8873  }
8874  goto __pyx_L4_argument_unpacking_done;
8875  __pyx_L5_argtuple_error:;
8876  __Pyx_RaiseArgtupleInvalid("_operator_dot", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1095, __pyx_L3_error)
8877  __pyx_L3_error:;
8878  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._operator_dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
8879  __Pyx_RefNannyFinishContext();
8880  return NULL;
8881  __pyx_L4_argument_unpacking_done:;
8882  __pyx_r = __pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(__pyx_self, __pyx_v_A, __pyx_v_AtA, __pyx_v_p, __pyx_v_gram, __pyx_v_assume_matrix, __pyx_v_solver_tol, __pyx_v_B, __pyx_v_E);
8883 
8884  /* function exit code */
8885  __Pyx_RefNannyFinishContext();
8886  return __pyx_r;
8887 }
8888 
8889 static PyObject *__pyx_pf_5imate_8traceinv_18_hutchinson_method_6_operator_dot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_AtA, PyObject *__pyx_v_p, PyObject *__pyx_v_gram, PyObject *__pyx_v_assume_matrix, PyObject *__pyx_v_solver_tol, PyObject *__pyx_v_B, PyObject *__pyx_v_E) {
8890  PyObject *__pyx_v_BE = NULL;
8891  PyObject *__pyx_v_OpE = NULL;
8892  CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
8893  CYTHON_UNUSED PyObject *__pyx_v_AinvpE = NULL;
8894  PyObject *__pyx_r = NULL;
8895  __Pyx_TraceDeclarations
8896  __Pyx_RefNannyDeclarations
8897  int __pyx_t_1;
8898  int __pyx_t_2;
8899  PyObject *__pyx_t_3 = NULL;
8900  PyObject *__pyx_t_4 = NULL;
8901  PyObject *__pyx_t_5 = NULL;
8902  PyObject *__pyx_t_6 = NULL;
8903  int __pyx_t_7;
8904  PyObject *__pyx_t_8 = NULL;
8905  Py_ssize_t __pyx_t_9;
8906  PyObject *(*__pyx_t_10)(PyObject *);
8907  int __pyx_lineno = 0;
8908  const char *__pyx_filename = NULL;
8909  int __pyx_clineno = 0;
8910  __Pyx_TraceFrameInit(__pyx_codeobj__7)
8911  __Pyx_RefNannySetupContext("_operator_dot", 0);
8912  __Pyx_TraceCall("_operator_dot", __pyx_f[0], 1095, 0, __PYX_ERR(0, 1095, __pyx_L1_error));
8913 
8914  /* "imate/traceinv/_hutchinson_method.pyx":1106
8915  *
8916  * # Multiply B by E
8917  * if B is not None: # <<<<<<<<<<<<<<
8918  * BE = B @ E
8919  * else:
8920  */
8921  __Pyx_TraceLine(1106,0,__PYX_ERR(0, 1106, __pyx_L1_error))
8922  __pyx_t_1 = (__pyx_v_B != Py_None);
8923  __pyx_t_2 = (__pyx_t_1 != 0);
8924  if (__pyx_t_2) {
8925 
8926  /* "imate/traceinv/_hutchinson_method.pyx":1107
8927  * # Multiply B by E
8928  * if B is not None:
8929  * BE = B @ E # <<<<<<<<<<<<<<
8930  * else:
8931  * # Assume B is identity matrix
8932  */
8933  __Pyx_TraceLine(1107,0,__PYX_ERR(0, 1107, __pyx_L1_error))
8934  __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_B, __pyx_v_E); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error)
8935  __Pyx_GOTREF(__pyx_t_3);
8936  __pyx_v_BE = __pyx_t_3;
8937  __pyx_t_3 = 0;
8938 
8939  /* "imate/traceinv/_hutchinson_method.pyx":1106
8940  *
8941  * # Multiply B by E
8942  * if B is not None: # <<<<<<<<<<<<<<
8943  * BE = B @ E
8944  * else:
8945  */
8946  goto __pyx_L3;
8947  }
8948 
8949  /* "imate/traceinv/_hutchinson_method.pyx":1110
8950  * else:
8951  * # Assume B is identity matrix
8952  * BE = E # <<<<<<<<<<<<<<
8953  *
8954  * # In the following, OpE is the action of the operator A**(-p) to the
8955  */
8956  __Pyx_TraceLine(1110,0,__PYX_ERR(0, 1110, __pyx_L1_error))
8957  /*else*/ {
8958  __Pyx_INCREF(__pyx_v_E);
8959  __pyx_v_BE = __pyx_v_E;
8960  }
8961  __pyx_L3:;
8962 
8963  /* "imate/traceinv/_hutchinson_method.pyx":1115
8964  * # vector BE. The exponent "p" is the "p" argument which is default
8965  * # to one. Ainv means the inverse of A.
8966  * if p == 0: # <<<<<<<<<<<<<<
8967  * # Ainvp is the identity matrix
8968  * OpE = BE
8969  */
8970  __Pyx_TraceLine(1115,0,__PYX_ERR(0, 1115, __pyx_L1_error))
8971  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __pyx_L1_error)
8972  __Pyx_GOTREF(__pyx_t_3);
8973  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1115, __pyx_L1_error)
8974  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8975  if (__pyx_t_2) {
8976 
8977  /* "imate/traceinv/_hutchinson_method.pyx":1117
8978  * if p == 0:
8979  * # Ainvp is the identity matrix
8980  * OpE = BE # <<<<<<<<<<<<<<
8981  *
8982  * elif p == 1:
8983  */
8984  __Pyx_TraceLine(1117,0,__PYX_ERR(0, 1117, __pyx_L1_error))
8985  __Pyx_INCREF(__pyx_v_BE);
8986  __pyx_v_OpE = __pyx_v_BE;
8987 
8988  /* "imate/traceinv/_hutchinson_method.pyx":1115
8989  * # vector BE. The exponent "p" is the "p" argument which is default
8990  * # to one. Ainv means the inverse of A.
8991  * if p == 0: # <<<<<<<<<<<<<<
8992  * # Ainvp is the identity matrix
8993  * OpE = BE
8994  */
8995  goto __pyx_L4;
8996  }
8997 
8998  /* "imate/traceinv/_hutchinson_method.pyx":1119
8999  * OpE = BE
9000  *
9001  * elif p == 1: # <<<<<<<<<<<<<<
9002  * # Perform inv(A) * BE. This requires GIL
9003  * if gram:
9004  */
9005  __Pyx_TraceLine(1119,0,__PYX_ERR(0, 1119, __pyx_L1_error))
9006  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error)
9007  __Pyx_GOTREF(__pyx_t_3);
9008  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1119, __pyx_L1_error)
9009  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9010  if (__pyx_t_2) {
9011 
9012  /* "imate/traceinv/_hutchinson_method.pyx":1121
9013  * elif p == 1:
9014  * # Perform inv(A) * BE. This requires GIL
9015  * if gram: # <<<<<<<<<<<<<<
9016  * if B is None:
9017  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol)
9018  */
9019  __Pyx_TraceLine(1121,0,__PYX_ERR(0, 1121, __pyx_L1_error))
9020  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 1121, __pyx_L1_error)
9021  if (__pyx_t_2) {
9022 
9023  /* "imate/traceinv/_hutchinson_method.pyx":1122
9024  * # Perform inv(A) * BE. This requires GIL
9025  * if gram:
9026  * if B is None: # <<<<<<<<<<<<<<
9027  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol)
9028  * else:
9029  */
9030  __Pyx_TraceLine(1122,0,__PYX_ERR(0, 1122, __pyx_L1_error))
9031  __pyx_t_2 = (__pyx_v_B == Py_None);
9032  __pyx_t_1 = (__pyx_t_2 != 0);
9033  if (__pyx_t_1) {
9034 
9035  /* "imate/traceinv/_hutchinson_method.pyx":1123
9036  * if gram:
9037  * if B is None:
9038  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
9039  * else:
9040  * OpE = linear_solver(AtA, BE, assume_matrix, solver_tol)
9041  */
9042  __Pyx_TraceLine(1123,0,__PYX_ERR(0, 1123, __pyx_L1_error))
9043  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1123, __pyx_L1_error)
9044  __Pyx_GOTREF(__pyx_t_4);
9045  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_T); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1123, __pyx_L1_error)
9046  __Pyx_GOTREF(__pyx_t_5);
9047  __pyx_t_6 = NULL;
9048  __pyx_t_7 = 0;
9049  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9050  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
9051  if (likely(__pyx_t_6)) {
9052  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9053  __Pyx_INCREF(__pyx_t_6);
9054  __Pyx_INCREF(function);
9055  __Pyx_DECREF_SET(__pyx_t_4, function);
9056  __pyx_t_7 = 1;
9057  }
9058  }
9059  #if CYTHON_FAST_PYCALL
9060  if (PyFunction_Check(__pyx_t_4)) {
9061  PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9062  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9063  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9064  __Pyx_GOTREF(__pyx_t_3);
9065  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9066  } else
9067  #endif
9068  #if CYTHON_FAST_PYCCALL
9069  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9070  PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_t_5, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9071  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9072  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9073  __Pyx_GOTREF(__pyx_t_3);
9074  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9075  } else
9076  #endif
9077  {
9078  __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1123, __pyx_L1_error)
9079  __Pyx_GOTREF(__pyx_t_8);
9080  if (__pyx_t_6) {
9081  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
9082  }
9083  __Pyx_GIVEREF(__pyx_t_5);
9084  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_5);
9085  __Pyx_INCREF(__pyx_v_BE);
9086  __Pyx_GIVEREF(__pyx_v_BE);
9087  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_BE);
9088  __Pyx_INCREF(__pyx_v_assume_matrix);
9089  __Pyx_GIVEREF(__pyx_v_assume_matrix);
9090  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_assume_matrix);
9091  __Pyx_INCREF(__pyx_v_solver_tol);
9092  __Pyx_GIVEREF(__pyx_v_solver_tol);
9093  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_solver_tol);
9094  __pyx_t_5 = 0;
9095  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1123, __pyx_L1_error)
9096  __Pyx_GOTREF(__pyx_t_3);
9097  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9098  }
9099  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9100  __pyx_v_OpE = __pyx_t_3;
9101  __pyx_t_3 = 0;
9102 
9103  /* "imate/traceinv/_hutchinson_method.pyx":1122
9104  * # Perform inv(A) * BE. This requires GIL
9105  * if gram:
9106  * if B is None: # <<<<<<<<<<<<<<
9107  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol)
9108  * else:
9109  */
9110  goto __pyx_L6;
9111  }
9112 
9113  /* "imate/traceinv/_hutchinson_method.pyx":1125
9114  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol)
9115  * else:
9116  * OpE = linear_solver(AtA, BE, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
9117  * else:
9118  * OpE = linear_solver(A, BE, assume_matrix, solver_tol)
9119  */
9120  __Pyx_TraceLine(1125,0,__PYX_ERR(0, 1125, __pyx_L1_error))
9121  /*else*/ {
9122  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1125, __pyx_L1_error)
9123  __Pyx_GOTREF(__pyx_t_4);
9124  __pyx_t_8 = NULL;
9125  __pyx_t_7 = 0;
9126  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9127  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
9128  if (likely(__pyx_t_8)) {
9129  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9130  __Pyx_INCREF(__pyx_t_8);
9131  __Pyx_INCREF(function);
9132  __Pyx_DECREF_SET(__pyx_t_4, function);
9133  __pyx_t_7 = 1;
9134  }
9135  }
9136  #if CYTHON_FAST_PYCALL
9137  if (PyFunction_Check(__pyx_t_4)) {
9138  PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_AtA, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9139  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9140  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9141  __Pyx_GOTREF(__pyx_t_3);
9142  } else
9143  #endif
9144  #if CYTHON_FAST_PYCCALL
9145  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9146  PyObject *__pyx_temp[5] = {__pyx_t_8, __pyx_v_AtA, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9147  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9148  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9149  __Pyx_GOTREF(__pyx_t_3);
9150  } else
9151  #endif
9152  {
9153  __pyx_t_5 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1125, __pyx_L1_error)
9154  __Pyx_GOTREF(__pyx_t_5);
9155  if (__pyx_t_8) {
9156  __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = NULL;
9157  }
9158  __Pyx_INCREF(__pyx_v_AtA);
9159  __Pyx_GIVEREF(__pyx_v_AtA);
9160  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_AtA);
9161  __Pyx_INCREF(__pyx_v_BE);
9162  __Pyx_GIVEREF(__pyx_v_BE);
9163  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_BE);
9164  __Pyx_INCREF(__pyx_v_assume_matrix);
9165  __Pyx_GIVEREF(__pyx_v_assume_matrix);
9166  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_assume_matrix);
9167  __Pyx_INCREF(__pyx_v_solver_tol);
9168  __Pyx_GIVEREF(__pyx_v_solver_tol);
9169  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_solver_tol);
9170  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1125, __pyx_L1_error)
9171  __Pyx_GOTREF(__pyx_t_3);
9172  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9173  }
9174  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9175  __pyx_v_OpE = __pyx_t_3;
9176  __pyx_t_3 = 0;
9177  }
9178  __pyx_L6:;
9179 
9180  /* "imate/traceinv/_hutchinson_method.pyx":1121
9181  * elif p == 1:
9182  * # Perform inv(A) * BE. This requires GIL
9183  * if gram: # <<<<<<<<<<<<<<
9184  * if B is None:
9185  * OpE = linear_solver(A.T, BE, assume_matrix, solver_tol)
9186  */
9187  goto __pyx_L5;
9188  }
9189 
9190  /* "imate/traceinv/_hutchinson_method.pyx":1127
9191  * OpE = linear_solver(AtA, BE, assume_matrix, solver_tol)
9192  * else:
9193  * OpE = linear_solver(A, BE, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
9194  *
9195  * elif p > 1:
9196  */
9197  __Pyx_TraceLine(1127,0,__PYX_ERR(0, 1127, __pyx_L1_error))
9198  /*else*/ {
9199  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1127, __pyx_L1_error)
9200  __Pyx_GOTREF(__pyx_t_4);
9201  __pyx_t_5 = NULL;
9202  __pyx_t_7 = 0;
9203  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9204  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
9205  if (likely(__pyx_t_5)) {
9206  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9207  __Pyx_INCREF(__pyx_t_5);
9208  __Pyx_INCREF(function);
9209  __Pyx_DECREF_SET(__pyx_t_4, function);
9210  __pyx_t_7 = 1;
9211  }
9212  }
9213  #if CYTHON_FAST_PYCALL
9214  if (PyFunction_Check(__pyx_t_4)) {
9215  PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_A, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9216  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9217  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9218  __Pyx_GOTREF(__pyx_t_3);
9219  } else
9220  #endif
9221  #if CYTHON_FAST_PYCCALL
9222  if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
9223  PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_A, __pyx_v_BE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9224  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9225  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9226  __Pyx_GOTREF(__pyx_t_3);
9227  } else
9228  #endif
9229  {
9230  __pyx_t_8 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1127, __pyx_L1_error)
9231  __Pyx_GOTREF(__pyx_t_8);
9232  if (__pyx_t_5) {
9233  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
9234  }
9235  __Pyx_INCREF(__pyx_v_A);
9236  __Pyx_GIVEREF(__pyx_v_A);
9237  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_v_A);
9238  __Pyx_INCREF(__pyx_v_BE);
9239  __Pyx_GIVEREF(__pyx_v_BE);
9240  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_BE);
9241  __Pyx_INCREF(__pyx_v_assume_matrix);
9242  __Pyx_GIVEREF(__pyx_v_assume_matrix);
9243  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_v_assume_matrix);
9244  __Pyx_INCREF(__pyx_v_solver_tol);
9245  __Pyx_GIVEREF(__pyx_v_solver_tol);
9246  PyTuple_SET_ITEM(__pyx_t_8, 3+__pyx_t_7, __pyx_v_solver_tol);
9247  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1127, __pyx_L1_error)
9248  __Pyx_GOTREF(__pyx_t_3);
9249  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9250  }
9251  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9252  __pyx_v_OpE = __pyx_t_3;
9253  __pyx_t_3 = 0;
9254  }
9255  __pyx_L5:;
9256 
9257  /* "imate/traceinv/_hutchinson_method.pyx":1119
9258  * OpE = BE
9259  *
9260  * elif p == 1: # <<<<<<<<<<<<<<
9261  * # Perform inv(A) * BE. This requires GIL
9262  * if gram:
9263  */
9264  goto __pyx_L4;
9265  }
9266 
9267  /* "imate/traceinv/_hutchinson_method.pyx":1129
9268  * OpE = linear_solver(A, BE, assume_matrix, solver_tol)
9269  *
9270  * elif p > 1: # <<<<<<<<<<<<<<
9271  * # Perform Ainv * Ainv * ... Ainv * BE where Ainv is repeated p times
9272  * # where p is the exponent.
9273  */
9274  __Pyx_TraceLine(1129,0,__PYX_ERR(0, 1129, __pyx_L1_error))
9275  __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1129, __pyx_L1_error)
9276  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1129, __pyx_L1_error)
9277  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9278  if (__pyx_t_1) {
9279 
9280  /* "imate/traceinv/_hutchinson_method.pyx":1132
9281  * # Perform Ainv * Ainv * ... Ainv * BE where Ainv is repeated p times
9282  * # where p is the exponent.
9283  * OpE = BE # <<<<<<<<<<<<<<
9284  *
9285  * if gram:
9286  */
9287  __Pyx_TraceLine(1132,0,__PYX_ERR(0, 1132, __pyx_L1_error))
9288  __Pyx_INCREF(__pyx_v_BE);
9289  __pyx_v_OpE = __pyx_v_BE;
9290 
9291  /* "imate/traceinv/_hutchinson_method.pyx":1134
9292  * OpE = BE
9293  *
9294  * if gram: # <<<<<<<<<<<<<<
9295  * for i in range(p):
9296  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9297  */
9298  __Pyx_TraceLine(1134,0,__PYX_ERR(0, 1134, __pyx_L1_error))
9299  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1134, __pyx_L1_error)
9300  if (__pyx_t_1) {
9301 
9302  /* "imate/traceinv/_hutchinson_method.pyx":1135
9303  *
9304  * if gram:
9305  * for i in range(p): # <<<<<<<<<<<<<<
9306  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9307  * else:
9308  */
9309  __Pyx_TraceLine(1135,0,__PYX_ERR(0, 1135, __pyx_L1_error))
9310  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_p); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9311  __Pyx_GOTREF(__pyx_t_3);
9312  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
9313  __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0;
9314  __pyx_t_10 = NULL;
9315  } else {
9316  __pyx_t_9 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1135, __pyx_L1_error)
9317  __Pyx_GOTREF(__pyx_t_4);
9318  __pyx_t_10 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1135, __pyx_L1_error)
9319  }
9320  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9321  for (;;) {
9322  if (likely(!__pyx_t_10)) {
9323  if (likely(PyList_CheckExact(__pyx_t_4))) {
9324  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_4)) break;
9325  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9326  __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
9327  #else
9328  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9329  __Pyx_GOTREF(__pyx_t_3);
9330  #endif
9331  } else {
9332  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
9333  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9334  __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1135, __pyx_L1_error)
9335  #else
9336  __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1135, __pyx_L1_error)
9337  __Pyx_GOTREF(__pyx_t_3);
9338  #endif
9339  }
9340  } else {
9341  __pyx_t_3 = __pyx_t_10(__pyx_t_4);
9342  if (unlikely(!__pyx_t_3)) {
9343  PyObject* exc_type = PyErr_Occurred();
9344  if (exc_type) {
9345  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9346  else __PYX_ERR(0, 1135, __pyx_L1_error)
9347  }
9348  break;
9349  }
9350  __Pyx_GOTREF(__pyx_t_3);
9351  }
9352  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
9353  __pyx_t_3 = 0;
9354 
9355  /* "imate/traceinv/_hutchinson_method.pyx":1136
9356  * if gram:
9357  * for i in range(p):
9358  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
9359  * else:
9360  * for i in range(p):
9361  */
9362  __Pyx_TraceLine(1136,0,__PYX_ERR(0, 1136, __pyx_L1_error))
9363  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1136, __pyx_L1_error)
9364  __Pyx_GOTREF(__pyx_t_8);
9365  __pyx_t_5 = NULL;
9366  __pyx_t_7 = 0;
9367  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9368  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
9369  if (likely(__pyx_t_5)) {
9370  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
9371  __Pyx_INCREF(__pyx_t_5);
9372  __Pyx_INCREF(function);
9373  __Pyx_DECREF_SET(__pyx_t_8, function);
9374  __pyx_t_7 = 1;
9375  }
9376  }
9377  #if CYTHON_FAST_PYCALL
9378  if (PyFunction_Check(__pyx_t_8)) {
9379  PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_AtA, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9380  __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9381  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9382  __Pyx_GOTREF(__pyx_t_3);
9383  } else
9384  #endif
9385  #if CYTHON_FAST_PYCCALL
9386  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
9387  PyObject *__pyx_temp[5] = {__pyx_t_5, __pyx_v_AtA, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9388  __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9389  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
9390  __Pyx_GOTREF(__pyx_t_3);
9391  } else
9392  #endif
9393  {
9394  __pyx_t_6 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1136, __pyx_L1_error)
9395  __Pyx_GOTREF(__pyx_t_6);
9396  if (__pyx_t_5) {
9397  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL;
9398  }
9399  __Pyx_INCREF(__pyx_v_AtA);
9400  __Pyx_GIVEREF(__pyx_v_AtA);
9401  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_AtA);
9402  __Pyx_INCREF(__pyx_v_OpE);
9403  __Pyx_GIVEREF(__pyx_v_OpE);
9404  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_OpE);
9405  __Pyx_INCREF(__pyx_v_assume_matrix);
9406  __Pyx_GIVEREF(__pyx_v_assume_matrix);
9407  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_7, __pyx_v_assume_matrix);
9408  __Pyx_INCREF(__pyx_v_solver_tol);
9409  __Pyx_GIVEREF(__pyx_v_solver_tol);
9410  PyTuple_SET_ITEM(__pyx_t_6, 3+__pyx_t_7, __pyx_v_solver_tol);
9411  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1136, __pyx_L1_error)
9412  __Pyx_GOTREF(__pyx_t_3);
9413  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9414  }
9415  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9416  __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_3);
9417  __pyx_t_3 = 0;
9418 
9419  /* "imate/traceinv/_hutchinson_method.pyx":1135
9420  *
9421  * if gram:
9422  * for i in range(p): # <<<<<<<<<<<<<<
9423  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9424  * else:
9425  */
9426  __Pyx_TraceLine(1135,0,__PYX_ERR(0, 1135, __pyx_L1_error))
9427  }
9428  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9429 
9430  /* "imate/traceinv/_hutchinson_method.pyx":1134
9431  * OpE = BE
9432  *
9433  * if gram: # <<<<<<<<<<<<<<
9434  * for i in range(p):
9435  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9436  */
9437  goto __pyx_L7;
9438  }
9439 
9440  /* "imate/traceinv/_hutchinson_method.pyx":1138
9441  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9442  * else:
9443  * for i in range(p): # <<<<<<<<<<<<<<
9444  * OpE = linear_solver(A, OpE, assume_matrix, solver_tol)
9445  *
9446  */
9447  __Pyx_TraceLine(1138,0,__PYX_ERR(0, 1138, __pyx_L1_error))
9448  /*else*/ {
9449  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_p); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9450  __Pyx_GOTREF(__pyx_t_4);
9451  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
9452  __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9453  __pyx_t_10 = NULL;
9454  } else {
9455  __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1138, __pyx_L1_error)
9456  __Pyx_GOTREF(__pyx_t_3);
9457  __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1138, __pyx_L1_error)
9458  }
9459  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9460  for (;;) {
9461  if (likely(!__pyx_t_10)) {
9462  if (likely(PyList_CheckExact(__pyx_t_3))) {
9463  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
9464  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9465  __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1138, __pyx_L1_error)
9466  #else
9467  __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9468  __Pyx_GOTREF(__pyx_t_4);
9469  #endif
9470  } else {
9471  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
9472  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9473  __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1138, __pyx_L1_error)
9474  #else
9475  __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1138, __pyx_L1_error)
9476  __Pyx_GOTREF(__pyx_t_4);
9477  #endif
9478  }
9479  } else {
9480  __pyx_t_4 = __pyx_t_10(__pyx_t_3);
9481  if (unlikely(!__pyx_t_4)) {
9482  PyObject* exc_type = PyErr_Occurred();
9483  if (exc_type) {
9484  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9485  else __PYX_ERR(0, 1138, __pyx_L1_error)
9486  }
9487  break;
9488  }
9489  __Pyx_GOTREF(__pyx_t_4);
9490  }
9491  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
9492  __pyx_t_4 = 0;
9493 
9494  /* "imate/traceinv/_hutchinson_method.pyx":1139
9495  * else:
9496  * for i in range(p):
9497  * OpE = linear_solver(A, OpE, assume_matrix, solver_tol) # <<<<<<<<<<<<<<
9498  *
9499  * elif p == -1:
9500  */
9501  __Pyx_TraceLine(1139,0,__PYX_ERR(0, 1139, __pyx_L1_error))
9502  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1139, __pyx_L1_error)
9503  __Pyx_GOTREF(__pyx_t_8);
9504  __pyx_t_6 = NULL;
9505  __pyx_t_7 = 0;
9506  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9507  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_8);
9508  if (likely(__pyx_t_6)) {
9509  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
9510  __Pyx_INCREF(__pyx_t_6);
9511  __Pyx_INCREF(function);
9512  __Pyx_DECREF_SET(__pyx_t_8, function);
9513  __pyx_t_7 = 1;
9514  }
9515  }
9516  #if CYTHON_FAST_PYCALL
9517  if (PyFunction_Check(__pyx_t_8)) {
9518  PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_A, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9519  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9520  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9521  __Pyx_GOTREF(__pyx_t_4);
9522  } else
9523  #endif
9524  #if CYTHON_FAST_PYCCALL
9525  if (__Pyx_PyFastCFunction_Check(__pyx_t_8)) {
9526  PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_v_A, __pyx_v_OpE, __pyx_v_assume_matrix, __pyx_v_solver_tol};
9527  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_8, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9528  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
9529  __Pyx_GOTREF(__pyx_t_4);
9530  } else
9531  #endif
9532  {
9533  __pyx_t_5 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1139, __pyx_L1_error)
9534  __Pyx_GOTREF(__pyx_t_5);
9535  if (__pyx_t_6) {
9536  __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL;
9537  }
9538  __Pyx_INCREF(__pyx_v_A);
9539  __Pyx_GIVEREF(__pyx_v_A);
9540  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_A);
9541  __Pyx_INCREF(__pyx_v_OpE);
9542  __Pyx_GIVEREF(__pyx_v_OpE);
9543  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_OpE);
9544  __Pyx_INCREF(__pyx_v_assume_matrix);
9545  __Pyx_GIVEREF(__pyx_v_assume_matrix);
9546  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_assume_matrix);
9547  __Pyx_INCREF(__pyx_v_solver_tol);
9548  __Pyx_GIVEREF(__pyx_v_solver_tol);
9549  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_7, __pyx_v_solver_tol);
9550  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1139, __pyx_L1_error)
9551  __Pyx_GOTREF(__pyx_t_4);
9552  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9553  }
9554  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9555  __Pyx_DECREF_SET(__pyx_v_OpE, __pyx_t_4);
9556  __pyx_t_4 = 0;
9557 
9558  /* "imate/traceinv/_hutchinson_method.pyx":1138
9559  * OpE = linear_solver(AtA, OpE, assume_matrix, solver_tol)
9560  * else:
9561  * for i in range(p): # <<<<<<<<<<<<<<
9562  * OpE = linear_solver(A, OpE, assume_matrix, solver_tol)
9563  *
9564  */
9565  __Pyx_TraceLine(1138,0,__PYX_ERR(0, 1138, __pyx_L1_error))
9566  }
9567  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9568  }
9569  __pyx_L7:;
9570 
9571  /* "imate/traceinv/_hutchinson_method.pyx":1129
9572  * OpE = linear_solver(A, BE, assume_matrix, solver_tol)
9573  *
9574  * elif p > 1: # <<<<<<<<<<<<<<
9575  * # Perform Ainv * Ainv * ... Ainv * BE where Ainv is repeated p times
9576  * # where p is the exponent.
9577  */
9578  goto __pyx_L4;
9579  }
9580 
9581  /* "imate/traceinv/_hutchinson_method.pyx":1141
9582  * OpE = linear_solver(A, OpE, assume_matrix, solver_tol)
9583  *
9584  * elif p == -1: # <<<<<<<<<<<<<<
9585  * # Performing Ainv**(-1) BE, where Ainv**(-1) it A itself.
9586  * OpE = A @ BE
9587  */
9588  __Pyx_TraceLine(1141,0,__PYX_ERR(0, 1141, __pyx_L1_error))
9589  __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_v_p, __pyx_int_neg_1, -1L, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1141, __pyx_L1_error)
9590  __Pyx_GOTREF(__pyx_t_3);
9591  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1141, __pyx_L1_error)
9592  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9593  if (__pyx_t_1) {
9594 
9595  /* "imate/traceinv/_hutchinson_method.pyx":1143
9596  * elif p == -1:
9597  * # Performing Ainv**(-1) BE, where Ainv**(-1) it A itself.
9598  * OpE = A @ BE # <<<<<<<<<<<<<<
9599  *
9600  * elif p < -1:
9601  */
9602  __Pyx_TraceLine(1143,0,__PYX_ERR(0, 1143, __pyx_L1_error))
9603  __pyx_t_3 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_A, __pyx_v_BE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1143, __pyx_L1_error)
9604  __Pyx_GOTREF(__pyx_t_3);
9605  __pyx_v_OpE = __pyx_t_3;
9606  __pyx_t_3 = 0;
9607 
9608  /* "imate/traceinv/_hutchinson_method.pyx":1141
9609  * OpE = linear_solver(A, OpE, assume_matrix, solver_tol)
9610  *
9611  * elif p == -1: # <<<<<<<<<<<<<<
9612  * # Performing Ainv**(-1) BE, where Ainv**(-1) it A itself.
9613  * OpE = A @ BE
9614  */
9615  goto __pyx_L4;
9616  }
9617 
9618  /* "imate/traceinv/_hutchinson_method.pyx":1145
9619  * OpE = A @ BE
9620  *
9621  * elif p < -1: # <<<<<<<<<<<<<<
9622  * # Performing Ainv**(-p) * BE where Ainv**(-p) = A**p.
9623  * AinvpE = BE
9624  */
9625  __Pyx_TraceLine(1145,0,__PYX_ERR(0, 1145, __pyx_L1_error))
9626  __pyx_t_3 = PyObject_RichCompare(__pyx_v_p, __pyx_int_neg_1, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1145, __pyx_L1_error)
9627  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1145, __pyx_L1_error)
9628  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9629  if (__pyx_t_1) {
9630 
9631  /* "imate/traceinv/_hutchinson_method.pyx":1147
9632  * elif p < -1:
9633  * # Performing Ainv**(-p) * BE where Ainv**(-p) = A**p.
9634  * AinvpE = BE # <<<<<<<<<<<<<<
9635  * if gram:
9636  * for i in range(numpy.abs(p)):
9637  */
9638  __Pyx_TraceLine(1147,0,__PYX_ERR(0, 1147, __pyx_L1_error))
9639  __Pyx_INCREF(__pyx_v_BE);
9640  __pyx_v_AinvpE = __pyx_v_BE;
9641 
9642  /* "imate/traceinv/_hutchinson_method.pyx":1148
9643  * # Performing Ainv**(-p) * BE where Ainv**(-p) = A**p.
9644  * AinvpE = BE
9645  * if gram: # <<<<<<<<<<<<<<
9646  * for i in range(numpy.abs(p)):
9647  * OpE = AtA @ OpE
9648  */
9649  __Pyx_TraceLine(1148,0,__PYX_ERR(0, 1148, __pyx_L1_error))
9650  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_gram); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 1148, __pyx_L1_error)
9651  if (__pyx_t_1) {
9652 
9653  /* "imate/traceinv/_hutchinson_method.pyx":1149
9654  * AinvpE = BE
9655  * if gram:
9656  * for i in range(numpy.abs(p)): # <<<<<<<<<<<<<<
9657  * OpE = AtA @ OpE
9658  * else:
9659  */
9660  __Pyx_TraceLine(1149,0,__PYX_ERR(0, 1149, __pyx_L1_error))
9661  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1149, __pyx_L1_error)
9662  __Pyx_GOTREF(__pyx_t_4);
9663  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_abs); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9664  __Pyx_GOTREF(__pyx_t_8);
9665  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9666  __pyx_t_4 = NULL;
9667  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_8))) {
9668  __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_8);
9669  if (likely(__pyx_t_4)) {
9670  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
9671  __Pyx_INCREF(__pyx_t_4);
9672  __Pyx_INCREF(function);
9673  __Pyx_DECREF_SET(__pyx_t_8, function);
9674  }
9675  }
9676  __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_8, __pyx_t_4, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_p);
9677  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
9678  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
9679  __Pyx_GOTREF(__pyx_t_3);
9680  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9681  __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9682  __Pyx_GOTREF(__pyx_t_8);
9683  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9684  if (likely(PyList_CheckExact(__pyx_t_8)) || PyTuple_CheckExact(__pyx_t_8)) {
9685  __pyx_t_3 = __pyx_t_8; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9686  __pyx_t_10 = NULL;
9687  } else {
9688  __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1149, __pyx_L1_error)
9689  __Pyx_GOTREF(__pyx_t_3);
9690  __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1149, __pyx_L1_error)
9691  }
9692  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9693  for (;;) {
9694  if (likely(!__pyx_t_10)) {
9695  if (likely(PyList_CheckExact(__pyx_t_3))) {
9696  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
9697  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9698  __pyx_t_8 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1149, __pyx_L1_error)
9699  #else
9700  __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9701  __Pyx_GOTREF(__pyx_t_8);
9702  #endif
9703  } else {
9704  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
9705  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9706  __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_8); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1149, __pyx_L1_error)
9707  #else
9708  __pyx_t_8 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1149, __pyx_L1_error)
9709  __Pyx_GOTREF(__pyx_t_8);
9710  #endif
9711  }
9712  } else {
9713  __pyx_t_8 = __pyx_t_10(__pyx_t_3);
9714  if (unlikely(!__pyx_t_8)) {
9715  PyObject* exc_type = PyErr_Occurred();
9716  if (exc_type) {
9717  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9718  else __PYX_ERR(0, 1149, __pyx_L1_error)
9719  }
9720  break;
9721  }
9722  __Pyx_GOTREF(__pyx_t_8);
9723  }
9724  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_8);
9725  __pyx_t_8 = 0;
9726 
9727  /* "imate/traceinv/_hutchinson_method.pyx":1150
9728  * if gram:
9729  * for i in range(numpy.abs(p)):
9730  * OpE = AtA @ OpE # <<<<<<<<<<<<<<
9731  * else:
9732  * for i in range(numpy.abs(p)):
9733  */
9734  __Pyx_TraceLine(1150,0,__PYX_ERR(0, 1150, __pyx_L1_error))
9735  if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError("OpE"); __PYX_ERR(0, 1150, __pyx_L1_error) }
9736  __pyx_t_8 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_AtA, __pyx_v_OpE); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1150, __pyx_L1_error)
9737  __Pyx_GOTREF(__pyx_t_8);
9738  __Pyx_XDECREF_SET(__pyx_v_OpE, __pyx_t_8);
9739  __pyx_t_8 = 0;
9740 
9741  /* "imate/traceinv/_hutchinson_method.pyx":1149
9742  * AinvpE = BE
9743  * if gram:
9744  * for i in range(numpy.abs(p)): # <<<<<<<<<<<<<<
9745  * OpE = AtA @ OpE
9746  * else:
9747  */
9748  __Pyx_TraceLine(1149,0,__PYX_ERR(0, 1149, __pyx_L1_error))
9749  }
9750  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9751 
9752  /* "imate/traceinv/_hutchinson_method.pyx":1148
9753  * # Performing Ainv**(-p) * BE where Ainv**(-p) = A**p.
9754  * AinvpE = BE
9755  * if gram: # <<<<<<<<<<<<<<
9756  * for i in range(numpy.abs(p)):
9757  * OpE = AtA @ OpE
9758  */
9759  goto __pyx_L12;
9760  }
9761 
9762  /* "imate/traceinv/_hutchinson_method.pyx":1152
9763  * OpE = AtA @ OpE
9764  * else:
9765  * for i in range(numpy.abs(p)): # <<<<<<<<<<<<<<
9766  * OpE = A @ OpE
9767  *
9768  */
9769  __Pyx_TraceLine(1152,0,__PYX_ERR(0, 1152, __pyx_L1_error))
9770  /*else*/ {
9771  __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_numpy); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 1152, __pyx_L1_error)
9772  __Pyx_GOTREF(__pyx_t_8);
9773  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_abs); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9774  __Pyx_GOTREF(__pyx_t_4);
9775  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
9776  __pyx_t_8 = NULL;
9777  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
9778  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
9779  if (likely(__pyx_t_8)) {
9780  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
9781  __Pyx_INCREF(__pyx_t_8);
9782  __Pyx_INCREF(function);
9783  __Pyx_DECREF_SET(__pyx_t_4, function);
9784  }
9785  }
9786  __pyx_t_3 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_8, __pyx_v_p) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_p);
9787  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
9788  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
9789  __Pyx_GOTREF(__pyx_t_3);
9790  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9791  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9792  __Pyx_GOTREF(__pyx_t_4);
9793  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9794  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
9795  __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0;
9796  __pyx_t_10 = NULL;
9797  } else {
9798  __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1152, __pyx_L1_error)
9799  __Pyx_GOTREF(__pyx_t_3);
9800  __pyx_t_10 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 1152, __pyx_L1_error)
9801  }
9802  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9803  for (;;) {
9804  if (likely(!__pyx_t_10)) {
9805  if (likely(PyList_CheckExact(__pyx_t_3))) {
9806  if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break;
9807  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9808  __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1152, __pyx_L1_error)
9809  #else
9810  __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9811  __Pyx_GOTREF(__pyx_t_4);
9812  #endif
9813  } else {
9814  if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
9815  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9816  __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_4); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 1152, __pyx_L1_error)
9817  #else
9818  __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1152, __pyx_L1_error)
9819  __Pyx_GOTREF(__pyx_t_4);
9820  #endif
9821  }
9822  } else {
9823  __pyx_t_4 = __pyx_t_10(__pyx_t_3);
9824  if (unlikely(!__pyx_t_4)) {
9825  PyObject* exc_type = PyErr_Occurred();
9826  if (exc_type) {
9827  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9828  else __PYX_ERR(0, 1152, __pyx_L1_error)
9829  }
9830  break;
9831  }
9832  __Pyx_GOTREF(__pyx_t_4);
9833  }
9834  __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
9835  __pyx_t_4 = 0;
9836 
9837  /* "imate/traceinv/_hutchinson_method.pyx":1153
9838  * else:
9839  * for i in range(numpy.abs(p)):
9840  * OpE = A @ OpE # <<<<<<<<<<<<<<
9841  *
9842  * return OpE
9843  */
9844  __Pyx_TraceLine(1153,0,__PYX_ERR(0, 1153, __pyx_L1_error))
9845  if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError("OpE"); __PYX_ERR(0, 1153, __pyx_L1_error) }
9846  __pyx_t_4 = __Pyx_PyNumber_MatrixMultiply(__pyx_v_A, __pyx_v_OpE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1153, __pyx_L1_error)
9847  __Pyx_GOTREF(__pyx_t_4);
9848  __Pyx_XDECREF_SET(__pyx_v_OpE, __pyx_t_4);
9849  __pyx_t_4 = 0;
9850 
9851  /* "imate/traceinv/_hutchinson_method.pyx":1152
9852  * OpE = AtA @ OpE
9853  * else:
9854  * for i in range(numpy.abs(p)): # <<<<<<<<<<<<<<
9855  * OpE = A @ OpE
9856  *
9857  */
9858  __Pyx_TraceLine(1152,0,__PYX_ERR(0, 1152, __pyx_L1_error))
9859  }
9860  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9861  }
9862  __pyx_L12:;
9863 
9864  /* "imate/traceinv/_hutchinson_method.pyx":1145
9865  * OpE = A @ BE
9866  *
9867  * elif p < -1: # <<<<<<<<<<<<<<
9868  * # Performing Ainv**(-p) * BE where Ainv**(-p) = A**p.
9869  * AinvpE = BE
9870  */
9871  }
9872  __pyx_L4:;
9873 
9874  /* "imate/traceinv/_hutchinson_method.pyx":1155
9875  * OpE = A @ OpE
9876  *
9877  * return OpE # <<<<<<<<<<<<<<
9878  */
9879  __Pyx_TraceLine(1155,0,__PYX_ERR(0, 1155, __pyx_L1_error))
9880  __Pyx_XDECREF(__pyx_r);
9881  if (unlikely(!__pyx_v_OpE)) { __Pyx_RaiseUnboundLocalError("OpE"); __PYX_ERR(0, 1155, __pyx_L1_error) }
9882  __Pyx_INCREF(__pyx_v_OpE);
9883  __pyx_r = __pyx_v_OpE;
9884  goto __pyx_L0;
9885 
9886  /* "imate/traceinv/_hutchinson_method.pyx":1095
9887  * # ============
9888  *
9889  * def _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E): # <<<<<<<<<<<<<<
9890  * """
9891  * Computes either of the followings:
9892  */
9893 
9894  /* function exit code */
9895  __pyx_L1_error:;
9896  __Pyx_XDECREF(__pyx_t_3);
9897  __Pyx_XDECREF(__pyx_t_4);
9898  __Pyx_XDECREF(__pyx_t_5);
9899  __Pyx_XDECREF(__pyx_t_6);
9900  __Pyx_XDECREF(__pyx_t_8);
9901  __Pyx_AddTraceback("imate.traceinv._hutchinson_method._operator_dot", __pyx_clineno, __pyx_lineno, __pyx_filename);
9902  __pyx_r = NULL;
9903  __pyx_L0:;
9904  __Pyx_XDECREF(__pyx_v_BE);
9905  __Pyx_XDECREF(__pyx_v_OpE);
9906  __Pyx_XDECREF(__pyx_v_i);
9907  __Pyx_XDECREF(__pyx_v_AinvpE);
9908  __Pyx_XGIVEREF(__pyx_r);
9909  __Pyx_TraceReturn(__pyx_r, 0);
9910  __Pyx_RefNannyFinishContext();
9911  return __pyx_r;
9912 }
9913 
9914 /* "View.MemoryView":123
9915  * cdef bint dtype_is_object
9916  *
9917  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
9918  * mode="c", bint allocate_buffer=True):
9919  *
9920  */
9921 
9922 /* Python wrapper */
9923 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
9924 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9925  PyObject *__pyx_v_shape = 0;
9926  Py_ssize_t __pyx_v_itemsize;
9927  PyObject *__pyx_v_format = 0;
9928  PyObject *__pyx_v_mode = 0;
9929  int __pyx_v_allocate_buffer;
9930  int __pyx_lineno = 0;
9931  const char *__pyx_filename = NULL;
9932  int __pyx_clineno = 0;
9933  int __pyx_r;
9934  __Pyx_RefNannyDeclarations
9935  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
9936  {
9937  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
9938  PyObject* values[5] = {0,0,0,0,0};
9939  values[3] = ((PyObject *)__pyx_n_s_c);
9940  if (unlikely(__pyx_kwds)) {
9941  Py_ssize_t kw_args;
9942  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9943  switch (pos_args) {
9944  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9945  CYTHON_FALLTHROUGH;
9946  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9947  CYTHON_FALLTHROUGH;
9948  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9949  CYTHON_FALLTHROUGH;
9950  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9951  CYTHON_FALLTHROUGH;
9952  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9953  CYTHON_FALLTHROUGH;
9954  case 0: break;
9955  default: goto __pyx_L5_argtuple_error;
9956  }
9957  kw_args = PyDict_Size(__pyx_kwds);
9958  switch (pos_args) {
9959  case 0:
9960  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
9961  else goto __pyx_L5_argtuple_error;
9962  CYTHON_FALLTHROUGH;
9963  case 1:
9964  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
9965  else {
9966  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 123, __pyx_L3_error)
9967  }
9968  CYTHON_FALLTHROUGH;
9969  case 2:
9970  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
9971  else {
9972  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 123, __pyx_L3_error)
9973  }
9974  CYTHON_FALLTHROUGH;
9975  case 3:
9976  if (kw_args > 0) {
9977  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
9978  if (value) { values[3] = value; kw_args--; }
9979  }
9980  CYTHON_FALLTHROUGH;
9981  case 4:
9982  if (kw_args > 0) {
9983  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
9984  if (value) { values[4] = value; kw_args--; }
9985  }
9986  }
9987  if (unlikely(kw_args > 0)) {
9988  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 123, __pyx_L3_error)
9989  }
9990  } else {
9991  switch (PyTuple_GET_SIZE(__pyx_args)) {
9992  case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
9993  CYTHON_FALLTHROUGH;
9994  case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
9995  CYTHON_FALLTHROUGH;
9996  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
9997  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
9998  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9999  break;
10000  default: goto __pyx_L5_argtuple_error;
10001  }
10002  }
10003  __pyx_v_shape = ((PyObject*)values[0]);
10004  __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
10005  __pyx_v_format = values[2];
10006  __pyx_v_mode = values[3];
10007  if (values[4]) {
10008  __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 124, __pyx_L3_error)
10009  } else {
10010 
10011  /* "View.MemoryView":124
10012  *
10013  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
10014  * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
10015  *
10016  * cdef int idx
10017  */
10018  __pyx_v_allocate_buffer = ((int)1);
10019  }
10020  }
10021  goto __pyx_L4_argument_unpacking_done;
10022  __pyx_L5_argtuple_error:;
10023  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 123, __pyx_L3_error)
10024  __pyx_L3_error:;
10025  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10026  __Pyx_RefNannyFinishContext();
10027  return -1;
10028  __pyx_L4_argument_unpacking_done:;
10029  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(1, 123, __pyx_L1_error)
10030  if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
10031  PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(1, 123, __pyx_L1_error)
10032  }
10033  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
10034 
10035  /* "View.MemoryView":123
10036  * cdef bint dtype_is_object
10037  *
10038  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
10039  * mode="c", bint allocate_buffer=True):
10040  *
10041  */
10042 
10043  /* function exit code */
10044  goto __pyx_L0;
10045  __pyx_L1_error:;
10046  __pyx_r = -1;
10047  __pyx_L0:;
10048  __Pyx_RefNannyFinishContext();
10049  return __pyx_r;
10050 }
10051 
10052 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode, int __pyx_v_allocate_buffer) {
10053  int __pyx_v_idx;
10054  Py_ssize_t __pyx_v_i;
10055  Py_ssize_t __pyx_v_dim;
10056  PyObject **__pyx_v_p;
10057  char __pyx_v_order;
10058  int __pyx_r;
10059  __Pyx_TraceDeclarations
10060  __Pyx_RefNannyDeclarations
10061  Py_ssize_t __pyx_t_1;
10062  int __pyx_t_2;
10063  PyObject *__pyx_t_3 = NULL;
10064  int __pyx_t_4;
10065  PyObject *__pyx_t_5 = NULL;
10066  PyObject *__pyx_t_6 = NULL;
10067  char *__pyx_t_7;
10068  int __pyx_t_8;
10069  Py_ssize_t __pyx_t_9;
10070  PyObject *__pyx_t_10 = NULL;
10071  Py_ssize_t __pyx_t_11;
10072  int __pyx_lineno = 0;
10073  const char *__pyx_filename = NULL;
10074  int __pyx_clineno = 0;
10075  __Pyx_RefNannySetupContext("__cinit__", 0);
10076  __Pyx_TraceCall("__cinit__", __pyx_f[1], 123, 0, __PYX_ERR(1, 123, __pyx_L1_error));
10077  __Pyx_INCREF(__pyx_v_format);
10078 
10079  /* "View.MemoryView":130
10080  * cdef PyObject **p
10081  *
10082  * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
10083  * self.itemsize = itemsize
10084  *
10085  */
10086  __Pyx_TraceLine(130,0,__PYX_ERR(1, 130, __pyx_L1_error))
10087  if (unlikely(__pyx_v_shape == Py_None)) {
10088  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
10089  __PYX_ERR(1, 130, __pyx_L1_error)
10090  }
10091  __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 130, __pyx_L1_error)
10092  __pyx_v_self->ndim = ((int)__pyx_t_1);
10093 
10094  /* "View.MemoryView":131
10095  *
10096  * self.ndim = <int> len(shape)
10097  * self.itemsize = itemsize # <<<<<<<<<<<<<<
10098  *
10099  * if not self.ndim:
10100  */
10101  __Pyx_TraceLine(131,0,__PYX_ERR(1, 131, __pyx_L1_error))
10102  __pyx_v_self->itemsize = __pyx_v_itemsize;
10103 
10104  /* "View.MemoryView":133
10105  * self.itemsize = itemsize
10106  *
10107  * if not self.ndim: # <<<<<<<<<<<<<<
10108  * raise ValueError("Empty shape tuple for cython.array")
10109  *
10110  */
10111  __Pyx_TraceLine(133,0,__PYX_ERR(1, 133, __pyx_L1_error))
10112  __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
10113  if (unlikely(__pyx_t_2)) {
10114 
10115  /* "View.MemoryView":134
10116  *
10117  * if not self.ndim:
10118  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
10119  *
10120  * if itemsize <= 0:
10121  */
10122  __Pyx_TraceLine(134,0,__PYX_ERR(1, 134, __pyx_L1_error))
10123  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 134, __pyx_L1_error)
10124  __Pyx_GOTREF(__pyx_t_3);
10125  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10126  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10127  __PYX_ERR(1, 134, __pyx_L1_error)
10128 
10129  /* "View.MemoryView":133
10130  * self.itemsize = itemsize
10131  *
10132  * if not self.ndim: # <<<<<<<<<<<<<<
10133  * raise ValueError("Empty shape tuple for cython.array")
10134  *
10135  */
10136  }
10137 
10138  /* "View.MemoryView":136
10139  * raise ValueError("Empty shape tuple for cython.array")
10140  *
10141  * if itemsize <= 0: # <<<<<<<<<<<<<<
10142  * raise ValueError("itemsize <= 0 for cython.array")
10143  *
10144  */
10145  __Pyx_TraceLine(136,0,__PYX_ERR(1, 136, __pyx_L1_error))
10146  __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
10147  if (unlikely(__pyx_t_2)) {
10148 
10149  /* "View.MemoryView":137
10150  *
10151  * if itemsize <= 0:
10152  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
10153  *
10154  * if not isinstance(format, bytes):
10155  */
10156  __Pyx_TraceLine(137,0,__PYX_ERR(1, 137, __pyx_L1_error))
10157  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 137, __pyx_L1_error)
10158  __Pyx_GOTREF(__pyx_t_3);
10159  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10160  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10161  __PYX_ERR(1, 137, __pyx_L1_error)
10162 
10163  /* "View.MemoryView":136
10164  * raise ValueError("Empty shape tuple for cython.array")
10165  *
10166  * if itemsize <= 0: # <<<<<<<<<<<<<<
10167  * raise ValueError("itemsize <= 0 for cython.array")
10168  *
10169  */
10170  }
10171 
10172  /* "View.MemoryView":139
10173  * raise ValueError("itemsize <= 0 for cython.array")
10174  *
10175  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
10176  * format = format.encode('ASCII')
10177  * self._format = format # keep a reference to the byte string
10178  */
10179  __Pyx_TraceLine(139,0,__PYX_ERR(1, 139, __pyx_L1_error))
10180  __pyx_t_2 = PyBytes_Check(__pyx_v_format);
10181  __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
10182  if (__pyx_t_4) {
10183 
10184  /* "View.MemoryView":140
10185  *
10186  * if not isinstance(format, bytes):
10187  * format = format.encode('ASCII') # <<<<<<<<<<<<<<
10188  * self._format = format # keep a reference to the byte string
10189  * self.format = self._format
10190  */
10191  __Pyx_TraceLine(140,0,__PYX_ERR(1, 140, __pyx_L1_error))
10192  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 140, __pyx_L1_error)
10193  __Pyx_GOTREF(__pyx_t_5);
10194  __pyx_t_6 = NULL;
10195  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10196  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
10197  if (likely(__pyx_t_6)) {
10198  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
10199  __Pyx_INCREF(__pyx_t_6);
10200  __Pyx_INCREF(function);
10201  __Pyx_DECREF_SET(__pyx_t_5, function);
10202  }
10203  }
10204  __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
10205  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10206  if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 140, __pyx_L1_error)
10207  __Pyx_GOTREF(__pyx_t_3);
10208  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10209  __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
10210  __pyx_t_3 = 0;
10211 
10212  /* "View.MemoryView":139
10213  * raise ValueError("itemsize <= 0 for cython.array")
10214  *
10215  * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
10216  * format = format.encode('ASCII')
10217  * self._format = format # keep a reference to the byte string
10218  */
10219  }
10220 
10221  /* "View.MemoryView":141
10222  * if not isinstance(format, bytes):
10223  * format = format.encode('ASCII')
10224  * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
10225  * self.format = self._format
10226  *
10227  */
10228  __Pyx_TraceLine(141,0,__PYX_ERR(1, 141, __pyx_L1_error))
10229  if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 141, __pyx_L1_error)
10230  __pyx_t_3 = __pyx_v_format;
10231  __Pyx_INCREF(__pyx_t_3);
10232  __Pyx_GIVEREF(__pyx_t_3);
10233  __Pyx_GOTREF(__pyx_v_self->_format);
10234  __Pyx_DECREF(__pyx_v_self->_format);
10235  __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
10236  __pyx_t_3 = 0;
10237 
10238  /* "View.MemoryView":142
10239  * format = format.encode('ASCII')
10240  * self._format = format # keep a reference to the byte string
10241  * self.format = self._format # <<<<<<<<<<<<<<
10242  *
10243  *
10244  */
10245  __Pyx_TraceLine(142,0,__PYX_ERR(1, 142, __pyx_L1_error))
10246  if (unlikely(__pyx_v_self->_format == Py_None)) {
10247  PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
10248  __PYX_ERR(1, 142, __pyx_L1_error)
10249  }
10250  __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 142, __pyx_L1_error)
10251  __pyx_v_self->format = __pyx_t_7;
10252 
10253  /* "View.MemoryView":145
10254  *
10255  *
10256  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
10257  * self._strides = self._shape + self.ndim
10258  *
10259  */
10260  __Pyx_TraceLine(145,0,__PYX_ERR(1, 145, __pyx_L1_error))
10261  __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
10262 
10263  /* "View.MemoryView":146
10264  *
10265  * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
10266  * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
10267  *
10268  * if not self._shape:
10269  */
10270  __Pyx_TraceLine(146,0,__PYX_ERR(1, 146, __pyx_L1_error))
10271  __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
10272 
10273  /* "View.MemoryView":148
10274  * self._strides = self._shape + self.ndim
10275  *
10276  * if not self._shape: # <<<<<<<<<<<<<<
10277  * raise MemoryError("unable to allocate shape and strides.")
10278  *
10279  */
10280  __Pyx_TraceLine(148,0,__PYX_ERR(1, 148, __pyx_L1_error))
10281  __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
10282  if (unlikely(__pyx_t_4)) {
10283 
10284  /* "View.MemoryView":149
10285  *
10286  * if not self._shape:
10287  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
10288  *
10289  *
10290  */
10291  __Pyx_TraceLine(149,0,__PYX_ERR(1, 149, __pyx_L1_error))
10292  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 149, __pyx_L1_error)
10293  __Pyx_GOTREF(__pyx_t_3);
10294  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10295  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10296  __PYX_ERR(1, 149, __pyx_L1_error)
10297 
10298  /* "View.MemoryView":148
10299  * self._strides = self._shape + self.ndim
10300  *
10301  * if not self._shape: # <<<<<<<<<<<<<<
10302  * raise MemoryError("unable to allocate shape and strides.")
10303  *
10304  */
10305  }
10306 
10307  /* "View.MemoryView":152
10308  *
10309  *
10310  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
10311  * if dim <= 0:
10312  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
10313  */
10314  __Pyx_TraceLine(152,0,__PYX_ERR(1, 152, __pyx_L1_error))
10315  __pyx_t_8 = 0;
10316  __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
10317  for (;;) {
10318  if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
10319  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
10320  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(1, 152, __pyx_L1_error)
10321  #else
10322  __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 152, __pyx_L1_error)
10323  __Pyx_GOTREF(__pyx_t_5);
10324  #endif
10325  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 152, __pyx_L1_error)
10326  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10327  __pyx_v_dim = __pyx_t_9;
10328  __pyx_v_idx = __pyx_t_8;
10329  __pyx_t_8 = (__pyx_t_8 + 1);
10330 
10331  /* "View.MemoryView":153
10332  *
10333  * for idx, dim in enumerate(shape):
10334  * if dim <= 0: # <<<<<<<<<<<<<<
10335  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
10336  * self._shape[idx] = dim
10337  */
10338  __Pyx_TraceLine(153,0,__PYX_ERR(1, 153, __pyx_L1_error))
10339  __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
10340  if (unlikely(__pyx_t_4)) {
10341 
10342  /* "View.MemoryView":154
10343  * for idx, dim in enumerate(shape):
10344  * if dim <= 0:
10345  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
10346  * self._shape[idx] = dim
10347  *
10348  */
10349  __Pyx_TraceLine(154,0,__PYX_ERR(1, 154, __pyx_L1_error))
10350  __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 154, __pyx_L1_error)
10351  __Pyx_GOTREF(__pyx_t_5);
10352  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 154, __pyx_L1_error)
10353  __Pyx_GOTREF(__pyx_t_6);
10354  __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 154, __pyx_L1_error)
10355  __Pyx_GOTREF(__pyx_t_10);
10356  __Pyx_GIVEREF(__pyx_t_5);
10357  PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
10358  __Pyx_GIVEREF(__pyx_t_6);
10359  PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
10360  __pyx_t_5 = 0;
10361  __pyx_t_6 = 0;
10362  __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 154, __pyx_L1_error)
10363  __Pyx_GOTREF(__pyx_t_6);
10364  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10365  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 154, __pyx_L1_error)
10366  __Pyx_GOTREF(__pyx_t_10);
10367  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10368  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10369  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10370  __PYX_ERR(1, 154, __pyx_L1_error)
10371 
10372  /* "View.MemoryView":153
10373  *
10374  * for idx, dim in enumerate(shape):
10375  * if dim <= 0: # <<<<<<<<<<<<<<
10376  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
10377  * self._shape[idx] = dim
10378  */
10379  }
10380 
10381  /* "View.MemoryView":155
10382  * if dim <= 0:
10383  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
10384  * self._shape[idx] = dim # <<<<<<<<<<<<<<
10385  *
10386  * cdef char order
10387  */
10388  __Pyx_TraceLine(155,0,__PYX_ERR(1, 155, __pyx_L1_error))
10389  (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
10390 
10391  /* "View.MemoryView":152
10392  *
10393  *
10394  * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
10395  * if dim <= 0:
10396  * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
10397  */
10398  __Pyx_TraceLine(152,0,__PYX_ERR(1, 152, __pyx_L1_error))
10399  }
10400  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10401 
10402  /* "View.MemoryView":158
10403  *
10404  * cdef char order
10405  * if mode == 'fortran': # <<<<<<<<<<<<<<
10406  * order = b'F'
10407  * self.mode = u'fortran'
10408  */
10409  __Pyx_TraceLine(158,0,__PYX_ERR(1, 158, __pyx_L1_error))
10410  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 158, __pyx_L1_error)
10411  if (__pyx_t_4) {
10412 
10413  /* "View.MemoryView":159
10414  * cdef char order
10415  * if mode == 'fortran':
10416  * order = b'F' # <<<<<<<<<<<<<<
10417  * self.mode = u'fortran'
10418  * elif mode == 'c':
10419  */
10420  __Pyx_TraceLine(159,0,__PYX_ERR(1, 159, __pyx_L1_error))
10421  __pyx_v_order = 'F';
10422 
10423  /* "View.MemoryView":160
10424  * if mode == 'fortran':
10425  * order = b'F'
10426  * self.mode = u'fortran' # <<<<<<<<<<<<<<
10427  * elif mode == 'c':
10428  * order = b'C'
10429  */
10430  __Pyx_TraceLine(160,0,__PYX_ERR(1, 160, __pyx_L1_error))
10431  __Pyx_INCREF(__pyx_n_u_fortran);
10432  __Pyx_GIVEREF(__pyx_n_u_fortran);
10433  __Pyx_GOTREF(__pyx_v_self->mode);
10434  __Pyx_DECREF(__pyx_v_self->mode);
10435  __pyx_v_self->mode = __pyx_n_u_fortran;
10436 
10437  /* "View.MemoryView":158
10438  *
10439  * cdef char order
10440  * if mode == 'fortran': # <<<<<<<<<<<<<<
10441  * order = b'F'
10442  * self.mode = u'fortran'
10443  */
10444  goto __pyx_L10;
10445  }
10446 
10447  /* "View.MemoryView":161
10448  * order = b'F'
10449  * self.mode = u'fortran'
10450  * elif mode == 'c': # <<<<<<<<<<<<<<
10451  * order = b'C'
10452  * self.mode = u'c'
10453  */
10454  __Pyx_TraceLine(161,0,__PYX_ERR(1, 161, __pyx_L1_error))
10455  __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 161, __pyx_L1_error)
10456  if (likely(__pyx_t_4)) {
10457 
10458  /* "View.MemoryView":162
10459  * self.mode = u'fortran'
10460  * elif mode == 'c':
10461  * order = b'C' # <<<<<<<<<<<<<<
10462  * self.mode = u'c'
10463  * else:
10464  */
10465  __Pyx_TraceLine(162,0,__PYX_ERR(1, 162, __pyx_L1_error))
10466  __pyx_v_order = 'C';
10467 
10468  /* "View.MemoryView":163
10469  * elif mode == 'c':
10470  * order = b'C'
10471  * self.mode = u'c' # <<<<<<<<<<<<<<
10472  * else:
10473  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
10474  */
10475  __Pyx_TraceLine(163,0,__PYX_ERR(1, 163, __pyx_L1_error))
10476  __Pyx_INCREF(__pyx_n_u_c);
10477  __Pyx_GIVEREF(__pyx_n_u_c);
10478  __Pyx_GOTREF(__pyx_v_self->mode);
10479  __Pyx_DECREF(__pyx_v_self->mode);
10480  __pyx_v_self->mode = __pyx_n_u_c;
10481 
10482  /* "View.MemoryView":161
10483  * order = b'F'
10484  * self.mode = u'fortran'
10485  * elif mode == 'c': # <<<<<<<<<<<<<<
10486  * order = b'C'
10487  * self.mode = u'c'
10488  */
10489  goto __pyx_L10;
10490  }
10491 
10492  /* "View.MemoryView":165
10493  * self.mode = u'c'
10494  * else:
10495  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
10496  *
10497  * self.len = fill_contig_strides_array(self._shape, self._strides,
10498  */
10499  __Pyx_TraceLine(165,0,__PYX_ERR(1, 165, __pyx_L1_error))
10500  /*else*/ {
10501  __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 165, __pyx_L1_error)
10502  __Pyx_GOTREF(__pyx_t_3);
10503  __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 165, __pyx_L1_error)
10504  __Pyx_GOTREF(__pyx_t_10);
10505  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10506  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10507  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10508  __PYX_ERR(1, 165, __pyx_L1_error)
10509  }
10510  __pyx_L10:;
10511 
10512  /* "View.MemoryView":167
10513  * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
10514  *
10515  * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
10516  * itemsize, self.ndim, order)
10517  *
10518  */
10519  __Pyx_TraceLine(167,0,__PYX_ERR(1, 167, __pyx_L1_error))
10520  __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
10521 
10522  /* "View.MemoryView":170
10523  * itemsize, self.ndim, order)
10524  *
10525  * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
10526  * self.dtype_is_object = format == b'O'
10527  * if allocate_buffer:
10528  */
10529  __Pyx_TraceLine(170,0,__PYX_ERR(1, 170, __pyx_L1_error))
10530  __pyx_v_self->free_data = __pyx_v_allocate_buffer;
10531 
10532  /* "View.MemoryView":171
10533  *
10534  * self.free_data = allocate_buffer
10535  * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
10536  * if allocate_buffer:
10537  *
10538  */
10539  __Pyx_TraceLine(171,0,__PYX_ERR(1, 171, __pyx_L1_error))
10540  __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 171, __pyx_L1_error)
10541  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 171, __pyx_L1_error)
10542  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10543  __pyx_v_self->dtype_is_object = __pyx_t_4;
10544 
10545  /* "View.MemoryView":172
10546  * self.free_data = allocate_buffer
10547  * self.dtype_is_object = format == b'O'
10548  * if allocate_buffer: # <<<<<<<<<<<<<<
10549  *
10550  *
10551  */
10552  __Pyx_TraceLine(172,0,__PYX_ERR(1, 172, __pyx_L1_error))
10553  __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
10554  if (__pyx_t_4) {
10555 
10556  /* "View.MemoryView":175
10557  *
10558  *
10559  * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
10560  * if not self.data:
10561  * raise MemoryError("unable to allocate array data.")
10562  */
10563  __Pyx_TraceLine(175,0,__PYX_ERR(1, 175, __pyx_L1_error))
10564  __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
10565 
10566  /* "View.MemoryView":176
10567  *
10568  * self.data = <char *>malloc(self.len)
10569  * if not self.data: # <<<<<<<<<<<<<<
10570  * raise MemoryError("unable to allocate array data.")
10571  *
10572  */
10573  __Pyx_TraceLine(176,0,__PYX_ERR(1, 176, __pyx_L1_error))
10574  __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
10575  if (unlikely(__pyx_t_4)) {
10576 
10577  /* "View.MemoryView":177
10578  * self.data = <char *>malloc(self.len)
10579  * if not self.data:
10580  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
10581  *
10582  * if self.dtype_is_object:
10583  */
10584  __Pyx_TraceLine(177,0,__PYX_ERR(1, 177, __pyx_L1_error))
10585  __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 177, __pyx_L1_error)
10586  __Pyx_GOTREF(__pyx_t_10);
10587  __Pyx_Raise(__pyx_t_10, 0, 0, 0);
10588  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
10589  __PYX_ERR(1, 177, __pyx_L1_error)
10590 
10591  /* "View.MemoryView":176
10592  *
10593  * self.data = <char *>malloc(self.len)
10594  * if not self.data: # <<<<<<<<<<<<<<
10595  * raise MemoryError("unable to allocate array data.")
10596  *
10597  */
10598  }
10599 
10600  /* "View.MemoryView":179
10601  * raise MemoryError("unable to allocate array data.")
10602  *
10603  * if self.dtype_is_object: # <<<<<<<<<<<<<<
10604  * p = <PyObject **> self.data
10605  * for i in range(self.len / itemsize):
10606  */
10607  __Pyx_TraceLine(179,0,__PYX_ERR(1, 179, __pyx_L1_error))
10608  __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
10609  if (__pyx_t_4) {
10610 
10611  /* "View.MemoryView":180
10612  *
10613  * if self.dtype_is_object:
10614  * p = <PyObject **> self.data # <<<<<<<<<<<<<<
10615  * for i in range(self.len / itemsize):
10616  * p[i] = Py_None
10617  */
10618  __Pyx_TraceLine(180,0,__PYX_ERR(1, 180, __pyx_L1_error))
10619  __pyx_v_p = ((PyObject **)__pyx_v_self->data);
10620 
10621  /* "View.MemoryView":181
10622  * if self.dtype_is_object:
10623  * p = <PyObject **> self.data
10624  * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
10625  * p[i] = Py_None
10626  * Py_INCREF(Py_None)
10627  */
10628  __Pyx_TraceLine(181,0,__PYX_ERR(1, 181, __pyx_L1_error))
10629  if (unlikely(__pyx_v_itemsize == 0)) {
10630  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
10631  __PYX_ERR(1, 181, __pyx_L1_error)
10632  }
10633  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
10634  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
10635  __PYX_ERR(1, 181, __pyx_L1_error)
10636  }
10637  __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
10638  __pyx_t_9 = __pyx_t_1;
10639  for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
10640  __pyx_v_i = __pyx_t_11;
10641 
10642  /* "View.MemoryView":182
10643  * p = <PyObject **> self.data
10644  * for i in range(self.len / itemsize):
10645  * p[i] = Py_None # <<<<<<<<<<<<<<
10646  * Py_INCREF(Py_None)
10647  *
10648  */
10649  __Pyx_TraceLine(182,0,__PYX_ERR(1, 182, __pyx_L1_error))
10650  (__pyx_v_p[__pyx_v_i]) = Py_None;
10651 
10652  /* "View.MemoryView":183
10653  * for i in range(self.len / itemsize):
10654  * p[i] = Py_None
10655  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
10656  *
10657  * @cname('getbuffer')
10658  */
10659  __Pyx_TraceLine(183,0,__PYX_ERR(1, 183, __pyx_L1_error))
10660  Py_INCREF(Py_None);
10661  }
10662 
10663  /* "View.MemoryView":179
10664  * raise MemoryError("unable to allocate array data.")
10665  *
10666  * if self.dtype_is_object: # <<<<<<<<<<<<<<
10667  * p = <PyObject **> self.data
10668  * for i in range(self.len / itemsize):
10669  */
10670  }
10671 
10672  /* "View.MemoryView":172
10673  * self.free_data = allocate_buffer
10674  * self.dtype_is_object = format == b'O'
10675  * if allocate_buffer: # <<<<<<<<<<<<<<
10676  *
10677  *
10678  */
10679  }
10680 
10681  /* "View.MemoryView":123
10682  * cdef bint dtype_is_object
10683  *
10684  * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
10685  * mode="c", bint allocate_buffer=True):
10686  *
10687  */
10688 
10689  /* function exit code */
10690  __pyx_r = 0;
10691  goto __pyx_L0;
10692  __pyx_L1_error:;
10693  __Pyx_XDECREF(__pyx_t_3);
10694  __Pyx_XDECREF(__pyx_t_5);
10695  __Pyx_XDECREF(__pyx_t_6);
10696  __Pyx_XDECREF(__pyx_t_10);
10697  __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10698  __pyx_r = -1;
10699  __pyx_L0:;
10700  __Pyx_XDECREF(__pyx_v_format);
10701  __Pyx_TraceReturn(Py_None, 0);
10702  __Pyx_RefNannyFinishContext();
10703  return __pyx_r;
10704 }
10705 
10706 /* "View.MemoryView":186
10707  *
10708  * @cname('getbuffer')
10709  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
10710  * cdef int bufmode = -1
10711  * if self.mode == u"c":
10712  */
10713 
10714 /* Python wrapper */
10715 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
10716 static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
10717  int __pyx_r;
10718  __Pyx_RefNannyDeclarations
10719  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
10720  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
10721 
10722  /* function exit code */
10723  __Pyx_RefNannyFinishContext();
10724  return __pyx_r;
10725 }
10726 
10727 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
10728  int __pyx_v_bufmode;
10729  int __pyx_r;
10730  __Pyx_TraceDeclarations
10731  __Pyx_RefNannyDeclarations
10732  int __pyx_t_1;
10733  int __pyx_t_2;
10734  PyObject *__pyx_t_3 = NULL;
10735  char *__pyx_t_4;
10736  Py_ssize_t __pyx_t_5;
10737  int __pyx_t_6;
10738  Py_ssize_t *__pyx_t_7;
10739  int __pyx_lineno = 0;
10740  const char *__pyx_filename = NULL;
10741  int __pyx_clineno = 0;
10742  if (__pyx_v_info == NULL) {
10743  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
10744  return -1;
10745  }
10746  __Pyx_RefNannySetupContext("__getbuffer__", 0);
10747  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
10748  __Pyx_GIVEREF(__pyx_v_info->obj);
10749  __Pyx_TraceCall("__getbuffer__", __pyx_f[1], 186, 0, __PYX_ERR(1, 186, __pyx_L1_error));
10750 
10751  /* "View.MemoryView":187
10752  * @cname('getbuffer')
10753  * def __getbuffer__(self, Py_buffer *info, int flags):
10754  * cdef int bufmode = -1 # <<<<<<<<<<<<<<
10755  * if self.mode == u"c":
10756  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10757  */
10758  __Pyx_TraceLine(187,0,__PYX_ERR(1, 187, __pyx_L1_error))
10759  __pyx_v_bufmode = -1;
10760 
10761  /* "View.MemoryView":188
10762  * def __getbuffer__(self, Py_buffer *info, int flags):
10763  * cdef int bufmode = -1
10764  * if self.mode == u"c": # <<<<<<<<<<<<<<
10765  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10766  * elif self.mode == u"fortran":
10767  */
10768  __Pyx_TraceLine(188,0,__PYX_ERR(1, 188, __pyx_L1_error))
10769  __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 188, __pyx_L1_error)
10770  __pyx_t_2 = (__pyx_t_1 != 0);
10771  if (__pyx_t_2) {
10772 
10773  /* "View.MemoryView":189
10774  * cdef int bufmode = -1
10775  * if self.mode == u"c":
10776  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
10777  * elif self.mode == u"fortran":
10778  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10779  */
10780  __Pyx_TraceLine(189,0,__PYX_ERR(1, 189, __pyx_L1_error))
10781  __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10782 
10783  /* "View.MemoryView":188
10784  * def __getbuffer__(self, Py_buffer *info, int flags):
10785  * cdef int bufmode = -1
10786  * if self.mode == u"c": # <<<<<<<<<<<<<<
10787  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10788  * elif self.mode == u"fortran":
10789  */
10790  goto __pyx_L3;
10791  }
10792 
10793  /* "View.MemoryView":190
10794  * if self.mode == u"c":
10795  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10796  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
10797  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10798  * if not (flags & bufmode):
10799  */
10800  __Pyx_TraceLine(190,0,__PYX_ERR(1, 190, __pyx_L1_error))
10801  __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 190, __pyx_L1_error)
10802  __pyx_t_1 = (__pyx_t_2 != 0);
10803  if (__pyx_t_1) {
10804 
10805  /* "View.MemoryView":191
10806  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10807  * elif self.mode == u"fortran":
10808  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
10809  * if not (flags & bufmode):
10810  * raise ValueError("Can only create a buffer that is contiguous in memory.")
10811  */
10812  __Pyx_TraceLine(191,0,__PYX_ERR(1, 191, __pyx_L1_error))
10813  __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
10814 
10815  /* "View.MemoryView":190
10816  * if self.mode == u"c":
10817  * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10818  * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
10819  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10820  * if not (flags & bufmode):
10821  */
10822  }
10823  __pyx_L3:;
10824 
10825  /* "View.MemoryView":192
10826  * elif self.mode == u"fortran":
10827  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10828  * if not (flags & bufmode): # <<<<<<<<<<<<<<
10829  * raise ValueError("Can only create a buffer that is contiguous in memory.")
10830  * info.buf = self.data
10831  */
10832  __Pyx_TraceLine(192,0,__PYX_ERR(1, 192, __pyx_L1_error))
10833  __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
10834  if (unlikely(__pyx_t_1)) {
10835 
10836  /* "View.MemoryView":193
10837  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10838  * if not (flags & bufmode):
10839  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
10840  * info.buf = self.data
10841  * info.len = self.len
10842  */
10843  __Pyx_TraceLine(193,0,__PYX_ERR(1, 193, __pyx_L1_error))
10844  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 193, __pyx_L1_error)
10845  __Pyx_GOTREF(__pyx_t_3);
10846  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10847  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10848  __PYX_ERR(1, 193, __pyx_L1_error)
10849 
10850  /* "View.MemoryView":192
10851  * elif self.mode == u"fortran":
10852  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
10853  * if not (flags & bufmode): # <<<<<<<<<<<<<<
10854  * raise ValueError("Can only create a buffer that is contiguous in memory.")
10855  * info.buf = self.data
10856  */
10857  }
10858 
10859  /* "View.MemoryView":194
10860  * if not (flags & bufmode):
10861  * raise ValueError("Can only create a buffer that is contiguous in memory.")
10862  * info.buf = self.data # <<<<<<<<<<<<<<
10863  * info.len = self.len
10864  * info.ndim = self.ndim
10865  */
10866  __Pyx_TraceLine(194,0,__PYX_ERR(1, 194, __pyx_L1_error))
10867  __pyx_t_4 = __pyx_v_self->data;
10868  __pyx_v_info->buf = __pyx_t_4;
10869 
10870  /* "View.MemoryView":195
10871  * raise ValueError("Can only create a buffer that is contiguous in memory.")
10872  * info.buf = self.data
10873  * info.len = self.len # <<<<<<<<<<<<<<
10874  * info.ndim = self.ndim
10875  * info.shape = self._shape
10876  */
10877  __Pyx_TraceLine(195,0,__PYX_ERR(1, 195, __pyx_L1_error))
10878  __pyx_t_5 = __pyx_v_self->len;
10879  __pyx_v_info->len = __pyx_t_5;
10880 
10881  /* "View.MemoryView":196
10882  * info.buf = self.data
10883  * info.len = self.len
10884  * info.ndim = self.ndim # <<<<<<<<<<<<<<
10885  * info.shape = self._shape
10886  * info.strides = self._strides
10887  */
10888  __Pyx_TraceLine(196,0,__PYX_ERR(1, 196, __pyx_L1_error))
10889  __pyx_t_6 = __pyx_v_self->ndim;
10890  __pyx_v_info->ndim = __pyx_t_6;
10891 
10892  /* "View.MemoryView":197
10893  * info.len = self.len
10894  * info.ndim = self.ndim
10895  * info.shape = self._shape # <<<<<<<<<<<<<<
10896  * info.strides = self._strides
10897  * info.suboffsets = NULL
10898  */
10899  __Pyx_TraceLine(197,0,__PYX_ERR(1, 197, __pyx_L1_error))
10900  __pyx_t_7 = __pyx_v_self->_shape;
10901  __pyx_v_info->shape = __pyx_t_7;
10902 
10903  /* "View.MemoryView":198
10904  * info.ndim = self.ndim
10905  * info.shape = self._shape
10906  * info.strides = self._strides # <<<<<<<<<<<<<<
10907  * info.suboffsets = NULL
10908  * info.itemsize = self.itemsize
10909  */
10910  __Pyx_TraceLine(198,0,__PYX_ERR(1, 198, __pyx_L1_error))
10911  __pyx_t_7 = __pyx_v_self->_strides;
10912  __pyx_v_info->strides = __pyx_t_7;
10913 
10914  /* "View.MemoryView":199
10915  * info.shape = self._shape
10916  * info.strides = self._strides
10917  * info.suboffsets = NULL # <<<<<<<<<<<<<<
10918  * info.itemsize = self.itemsize
10919  * info.readonly = 0
10920  */
10921  __Pyx_TraceLine(199,0,__PYX_ERR(1, 199, __pyx_L1_error))
10922  __pyx_v_info->suboffsets = NULL;
10923 
10924  /* "View.MemoryView":200
10925  * info.strides = self._strides
10926  * info.suboffsets = NULL
10927  * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
10928  * info.readonly = 0
10929  *
10930  */
10931  __Pyx_TraceLine(200,0,__PYX_ERR(1, 200, __pyx_L1_error))
10932  __pyx_t_5 = __pyx_v_self->itemsize;
10933  __pyx_v_info->itemsize = __pyx_t_5;
10934 
10935  /* "View.MemoryView":201
10936  * info.suboffsets = NULL
10937  * info.itemsize = self.itemsize
10938  * info.readonly = 0 # <<<<<<<<<<<<<<
10939  *
10940  * if flags & PyBUF_FORMAT:
10941  */
10942  __Pyx_TraceLine(201,0,__PYX_ERR(1, 201, __pyx_L1_error))
10943  __pyx_v_info->readonly = 0;
10944 
10945  /* "View.MemoryView":203
10946  * info.readonly = 0
10947  *
10948  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10949  * info.format = self.format
10950  * else:
10951  */
10952  __Pyx_TraceLine(203,0,__PYX_ERR(1, 203, __pyx_L1_error))
10953  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10954  if (__pyx_t_1) {
10955 
10956  /* "View.MemoryView":204
10957  *
10958  * if flags & PyBUF_FORMAT:
10959  * info.format = self.format # <<<<<<<<<<<<<<
10960  * else:
10961  * info.format = NULL
10962  */
10963  __Pyx_TraceLine(204,0,__PYX_ERR(1, 204, __pyx_L1_error))
10964  __pyx_t_4 = __pyx_v_self->format;
10965  __pyx_v_info->format = __pyx_t_4;
10966 
10967  /* "View.MemoryView":203
10968  * info.readonly = 0
10969  *
10970  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
10971  * info.format = self.format
10972  * else:
10973  */
10974  goto __pyx_L5;
10975  }
10976 
10977  /* "View.MemoryView":206
10978  * info.format = self.format
10979  * else:
10980  * info.format = NULL # <<<<<<<<<<<<<<
10981  *
10982  * info.obj = self
10983  */
10984  __Pyx_TraceLine(206,0,__PYX_ERR(1, 206, __pyx_L1_error))
10985  /*else*/ {
10986  __pyx_v_info->format = NULL;
10987  }
10988  __pyx_L5:;
10989 
10990  /* "View.MemoryView":208
10991  * info.format = NULL
10992  *
10993  * info.obj = self # <<<<<<<<<<<<<<
10994  *
10995  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
10996  */
10997  __Pyx_TraceLine(208,0,__PYX_ERR(1, 208, __pyx_L1_error))
10998  __Pyx_INCREF(((PyObject *)__pyx_v_self));
10999  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11000  __Pyx_GOTREF(__pyx_v_info->obj);
11001  __Pyx_DECREF(__pyx_v_info->obj);
11002  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11003 
11004  /* "View.MemoryView":186
11005  *
11006  * @cname('getbuffer')
11007  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
11008  * cdef int bufmode = -1
11009  * if self.mode == u"c":
11010  */
11011 
11012  /* function exit code */
11013  __pyx_r = 0;
11014  goto __pyx_L0;
11015  __pyx_L1_error:;
11016  __Pyx_XDECREF(__pyx_t_3);
11017  __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11018  __pyx_r = -1;
11019  if (__pyx_v_info->obj != NULL) {
11020  __Pyx_GOTREF(__pyx_v_info->obj);
11021  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11022  }
11023  goto __pyx_L2;
11024  __pyx_L0:;
11025  if (__pyx_v_info->obj == Py_None) {
11026  __Pyx_GOTREF(__pyx_v_info->obj);
11027  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11028  }
11029  __pyx_L2:;
11030  __Pyx_TraceReturn(Py_None, 0);
11031  __Pyx_RefNannyFinishContext();
11032  return __pyx_r;
11033 }
11034 
11035 /* "View.MemoryView":212
11036  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
11037  *
11038  * def __dealloc__(array self): # <<<<<<<<<<<<<<
11039  * if self.callback_free_data != NULL:
11040  * self.callback_free_data(self.data)
11041  */
11042 
11043 /* Python wrapper */
11044 static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
11045 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
11046  __Pyx_RefNannyDeclarations
11047  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
11048  __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
11049 
11050  /* function exit code */
11051  __Pyx_RefNannyFinishContext();
11052 }
11053 
11054 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
11055  __Pyx_TraceDeclarations
11056  __Pyx_RefNannyDeclarations
11057  int __pyx_t_1;
11058  int __pyx_lineno = 0;
11059  const char *__pyx_filename = NULL;
11060  int __pyx_clineno = 0;
11061  __Pyx_RefNannySetupContext("__dealloc__", 0);
11062  __Pyx_TraceCall("__dealloc__", __pyx_f[1], 212, 0, __PYX_ERR(1, 212, __pyx_L1_error));
11063 
11064  /* "View.MemoryView":213
11065  *
11066  * def __dealloc__(array self):
11067  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
11068  * self.callback_free_data(self.data)
11069  * elif self.free_data:
11070  */
11071  __Pyx_TraceLine(213,0,__PYX_ERR(1, 213, __pyx_L1_error))
11072  __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
11073  if (__pyx_t_1) {
11074 
11075  /* "View.MemoryView":214
11076  * def __dealloc__(array self):
11077  * if self.callback_free_data != NULL:
11078  * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
11079  * elif self.free_data:
11080  * if self.dtype_is_object:
11081  */
11082  __Pyx_TraceLine(214,0,__PYX_ERR(1, 214, __pyx_L1_error))
11083  __pyx_v_self->callback_free_data(__pyx_v_self->data);
11084 
11085  /* "View.MemoryView":213
11086  *
11087  * def __dealloc__(array self):
11088  * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
11089  * self.callback_free_data(self.data)
11090  * elif self.free_data:
11091  */
11092  goto __pyx_L3;
11093  }
11094 
11095  /* "View.MemoryView":215
11096  * if self.callback_free_data != NULL:
11097  * self.callback_free_data(self.data)
11098  * elif self.free_data: # <<<<<<<<<<<<<<
11099  * if self.dtype_is_object:
11100  * refcount_objects_in_slice(self.data, self._shape,
11101  */
11102  __Pyx_TraceLine(215,0,__PYX_ERR(1, 215, __pyx_L1_error))
11103  __pyx_t_1 = (__pyx_v_self->free_data != 0);
11104  if (__pyx_t_1) {
11105 
11106  /* "View.MemoryView":216
11107  * self.callback_free_data(self.data)
11108  * elif self.free_data:
11109  * if self.dtype_is_object: # <<<<<<<<<<<<<<
11110  * refcount_objects_in_slice(self.data, self._shape,
11111  * self._strides, self.ndim, False)
11112  */
11113  __Pyx_TraceLine(216,0,__PYX_ERR(1, 216, __pyx_L1_error))
11114  __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
11115  if (__pyx_t_1) {
11116 
11117  /* "View.MemoryView":217
11118  * elif self.free_data:
11119  * if self.dtype_is_object:
11120  * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
11121  * self._strides, self.ndim, False)
11122  * free(self.data)
11123  */
11124  __Pyx_TraceLine(217,0,__PYX_ERR(1, 217, __pyx_L1_error))
11125  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
11126 
11127  /* "View.MemoryView":216
11128  * self.callback_free_data(self.data)
11129  * elif self.free_data:
11130  * if self.dtype_is_object: # <<<<<<<<<<<<<<
11131  * refcount_objects_in_slice(self.data, self._shape,
11132  * self._strides, self.ndim, False)
11133  */
11134  }
11135 
11136  /* "View.MemoryView":219
11137  * refcount_objects_in_slice(self.data, self._shape,
11138  * self._strides, self.ndim, False)
11139  * free(self.data) # <<<<<<<<<<<<<<
11140  * PyObject_Free(self._shape)
11141  *
11142  */
11143  __Pyx_TraceLine(219,0,__PYX_ERR(1, 219, __pyx_L1_error))
11144  free(__pyx_v_self->data);
11145 
11146  /* "View.MemoryView":215
11147  * if self.callback_free_data != NULL:
11148  * self.callback_free_data(self.data)
11149  * elif self.free_data: # <<<<<<<<<<<<<<
11150  * if self.dtype_is_object:
11151  * refcount_objects_in_slice(self.data, self._shape,
11152  */
11153  }
11154  __pyx_L3:;
11155 
11156  /* "View.MemoryView":220
11157  * self._strides, self.ndim, False)
11158  * free(self.data)
11159  * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
11160  *
11161  * @property
11162  */
11163  __Pyx_TraceLine(220,0,__PYX_ERR(1, 220, __pyx_L1_error))
11164  PyObject_Free(__pyx_v_self->_shape);
11165 
11166  /* "View.MemoryView":212
11167  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
11168  *
11169  * def __dealloc__(array self): # <<<<<<<<<<<<<<
11170  * if self.callback_free_data != NULL:
11171  * self.callback_free_data(self.data)
11172  */
11173 
11174  /* function exit code */
11175  goto __pyx_L0;
11176  __pyx_L1_error:;
11177  __Pyx_WriteUnraisable("View.MemoryView.array.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
11178  __pyx_L0:;
11179  __Pyx_TraceReturn(Py_None, 0);
11180  __Pyx_RefNannyFinishContext();
11181 }
11182 
11183 /* "View.MemoryView":223
11184  *
11185  * @property
11186  * def memview(self): # <<<<<<<<<<<<<<
11187  * return self.get_memview()
11188  *
11189  */
11190 
11191 /* Python wrapper */
11192 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
11193 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
11194  PyObject *__pyx_r = 0;
11195  __Pyx_RefNannyDeclarations
11196  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
11197  __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
11198 
11199  /* function exit code */
11200  __Pyx_RefNannyFinishContext();
11201  return __pyx_r;
11202 }
11203 
11204 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
11205  PyObject *__pyx_r = NULL;
11206  __Pyx_TraceDeclarations
11207  __Pyx_RefNannyDeclarations
11208  PyObject *__pyx_t_1 = NULL;
11209  int __pyx_lineno = 0;
11210  const char *__pyx_filename = NULL;
11211  int __pyx_clineno = 0;
11212  __Pyx_RefNannySetupContext("__get__", 0);
11213  __Pyx_TraceCall("__get__", __pyx_f[1], 223, 0, __PYX_ERR(1, 223, __pyx_L1_error));
11214 
11215  /* "View.MemoryView":224
11216  * @property
11217  * def memview(self):
11218  * return self.get_memview() # <<<<<<<<<<<<<<
11219  *
11220  * @cname('get_memview')
11221  */
11222  __Pyx_TraceLine(224,0,__PYX_ERR(1, 224, __pyx_L1_error))
11223  __Pyx_XDECREF(__pyx_r);
11224  __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 224, __pyx_L1_error)
11225  __Pyx_GOTREF(__pyx_t_1);
11226  __pyx_r = __pyx_t_1;
11227  __pyx_t_1 = 0;
11228  goto __pyx_L0;
11229 
11230  /* "View.MemoryView":223
11231  *
11232  * @property
11233  * def memview(self): # <<<<<<<<<<<<<<
11234  * return self.get_memview()
11235  *
11236  */
11237 
11238  /* function exit code */
11239  __pyx_L1_error:;
11240  __Pyx_XDECREF(__pyx_t_1);
11241  __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11242  __pyx_r = NULL;
11243  __pyx_L0:;
11244  __Pyx_XGIVEREF(__pyx_r);
11245  __Pyx_TraceReturn(__pyx_r, 0);
11246  __Pyx_RefNannyFinishContext();
11247  return __pyx_r;
11248 }
11249 
11250 /* "View.MemoryView":227
11251  *
11252  * @cname('get_memview')
11253  * cdef get_memview(self): # <<<<<<<<<<<<<<
11254  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
11255  * return memoryview(self, flags, self.dtype_is_object)
11256  */
11257 
11258 static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
11259  int __pyx_v_flags;
11260  PyObject *__pyx_r = NULL;
11261  __Pyx_TraceDeclarations
11262  __Pyx_RefNannyDeclarations
11263  PyObject *__pyx_t_1 = NULL;
11264  PyObject *__pyx_t_2 = NULL;
11265  PyObject *__pyx_t_3 = NULL;
11266  int __pyx_lineno = 0;
11267  const char *__pyx_filename = NULL;
11268  int __pyx_clineno = 0;
11269  __Pyx_RefNannySetupContext("get_memview", 0);
11270  __Pyx_TraceCall("get_memview", __pyx_f[1], 227, 0, __PYX_ERR(1, 227, __pyx_L1_error));
11271 
11272  /* "View.MemoryView":228
11273  * @cname('get_memview')
11274  * cdef get_memview(self):
11275  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
11276  * return memoryview(self, flags, self.dtype_is_object)
11277  *
11278  */
11279  __Pyx_TraceLine(228,0,__PYX_ERR(1, 228, __pyx_L1_error))
11280  __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
11281 
11282  /* "View.MemoryView":229
11283  * cdef get_memview(self):
11284  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
11285  * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
11286  *
11287  * def __len__(self):
11288  */
11289  __Pyx_TraceLine(229,0,__PYX_ERR(1, 229, __pyx_L1_error))
11290  __Pyx_XDECREF(__pyx_r);
11291  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 229, __pyx_L1_error)
11292  __Pyx_GOTREF(__pyx_t_1);
11293  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 229, __pyx_L1_error)
11294  __Pyx_GOTREF(__pyx_t_2);
11295  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 229, __pyx_L1_error)
11296  __Pyx_GOTREF(__pyx_t_3);
11297  __Pyx_INCREF(((PyObject *)__pyx_v_self));
11298  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11299  PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
11300  __Pyx_GIVEREF(__pyx_t_1);
11301  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
11302  __Pyx_GIVEREF(__pyx_t_2);
11303  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
11304  __pyx_t_1 = 0;
11305  __pyx_t_2 = 0;
11306  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 229, __pyx_L1_error)
11307  __Pyx_GOTREF(__pyx_t_2);
11308  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11309  __pyx_r = __pyx_t_2;
11310  __pyx_t_2 = 0;
11311  goto __pyx_L0;
11312 
11313  /* "View.MemoryView":227
11314  *
11315  * @cname('get_memview')
11316  * cdef get_memview(self): # <<<<<<<<<<<<<<
11317  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
11318  * return memoryview(self, flags, self.dtype_is_object)
11319  */
11320 
11321  /* function exit code */
11322  __pyx_L1_error:;
11323  __Pyx_XDECREF(__pyx_t_1);
11324  __Pyx_XDECREF(__pyx_t_2);
11325  __Pyx_XDECREF(__pyx_t_3);
11326  __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
11327  __pyx_r = 0;
11328  __pyx_L0:;
11329  __Pyx_XGIVEREF(__pyx_r);
11330  __Pyx_TraceReturn(__pyx_r, 0);
11331  __Pyx_RefNannyFinishContext();
11332  return __pyx_r;
11333 }
11334 
11335 /* "View.MemoryView":231
11336  * return memoryview(self, flags, self.dtype_is_object)
11337  *
11338  * def __len__(self): # <<<<<<<<<<<<<<
11339  * return self._shape[0]
11340  *
11341  */
11342 
11343 /* Python wrapper */
11344 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
11345 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
11346  Py_ssize_t __pyx_r;
11347  __Pyx_RefNannyDeclarations
11348  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
11349  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
11350 
11351  /* function exit code */
11352  __Pyx_RefNannyFinishContext();
11353  return __pyx_r;
11354 }
11355 
11356 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
11357  Py_ssize_t __pyx_r;
11358  __Pyx_TraceDeclarations
11359  __Pyx_RefNannyDeclarations
11360  int __pyx_lineno = 0;
11361  const char *__pyx_filename = NULL;
11362  int __pyx_clineno = 0;
11363  __Pyx_RefNannySetupContext("__len__", 0);
11364  __Pyx_TraceCall("__len__", __pyx_f[1], 231, 0, __PYX_ERR(1, 231, __pyx_L1_error));
11365 
11366  /* "View.MemoryView":232
11367  *
11368  * def __len__(self):
11369  * return self._shape[0] # <<<<<<<<<<<<<<
11370  *
11371  * def __getattr__(self, attr):
11372  */
11373  __Pyx_TraceLine(232,0,__PYX_ERR(1, 232, __pyx_L1_error))
11374  __pyx_r = (__pyx_v_self->_shape[0]);
11375  goto __pyx_L0;
11376 
11377  /* "View.MemoryView":231
11378  * return memoryview(self, flags, self.dtype_is_object)
11379  *
11380  * def __len__(self): # <<<<<<<<<<<<<<
11381  * return self._shape[0]
11382  *
11383  */
11384 
11385  /* function exit code */
11386  __pyx_L1_error:;
11387  __Pyx_AddTraceback("View.MemoryView.array.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11388  __pyx_r = -1;
11389  __pyx_L0:;
11390  __Pyx_TraceReturn(Py_None, 0);
11391  __Pyx_RefNannyFinishContext();
11392  return __pyx_r;
11393 }
11394 
11395 /* "View.MemoryView":234
11396  * return self._shape[0]
11397  *
11398  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
11399  * return getattr(self.memview, attr)
11400  *
11401  */
11402 
11403 /* Python wrapper */
11404 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
11405 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
11406  PyObject *__pyx_r = 0;
11407  __Pyx_RefNannyDeclarations
11408  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
11409  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
11410 
11411  /* function exit code */
11412  __Pyx_RefNannyFinishContext();
11413  return __pyx_r;
11414 }
11415 
11416 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
11417  PyObject *__pyx_r = NULL;
11418  __Pyx_TraceDeclarations
11419  __Pyx_RefNannyDeclarations
11420  PyObject *__pyx_t_1 = NULL;
11421  PyObject *__pyx_t_2 = NULL;
11422  int __pyx_lineno = 0;
11423  const char *__pyx_filename = NULL;
11424  int __pyx_clineno = 0;
11425  __Pyx_RefNannySetupContext("__getattr__", 0);
11426  __Pyx_TraceCall("__getattr__", __pyx_f[1], 234, 0, __PYX_ERR(1, 234, __pyx_L1_error));
11427 
11428  /* "View.MemoryView":235
11429  *
11430  * def __getattr__(self, attr):
11431  * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
11432  *
11433  * def __getitem__(self, item):
11434  */
11435  __Pyx_TraceLine(235,0,__PYX_ERR(1, 235, __pyx_L1_error))
11436  __Pyx_XDECREF(__pyx_r);
11437  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 235, __pyx_L1_error)
11438  __Pyx_GOTREF(__pyx_t_1);
11439  __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 235, __pyx_L1_error)
11440  __Pyx_GOTREF(__pyx_t_2);
11441  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11442  __pyx_r = __pyx_t_2;
11443  __pyx_t_2 = 0;
11444  goto __pyx_L0;
11445 
11446  /* "View.MemoryView":234
11447  * return self._shape[0]
11448  *
11449  * def __getattr__(self, attr): # <<<<<<<<<<<<<<
11450  * return getattr(self.memview, attr)
11451  *
11452  */
11453 
11454  /* function exit code */
11455  __pyx_L1_error:;
11456  __Pyx_XDECREF(__pyx_t_1);
11457  __Pyx_XDECREF(__pyx_t_2);
11458  __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11459  __pyx_r = NULL;
11460  __pyx_L0:;
11461  __Pyx_XGIVEREF(__pyx_r);
11462  __Pyx_TraceReturn(__pyx_r, 0);
11463  __Pyx_RefNannyFinishContext();
11464  return __pyx_r;
11465 }
11466 
11467 /* "View.MemoryView":237
11468  * return getattr(self.memview, attr)
11469  *
11470  * def __getitem__(self, item): # <<<<<<<<<<<<<<
11471  * return self.memview[item]
11472  *
11473  */
11474 
11475 /* Python wrapper */
11476 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
11477 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
11478  PyObject *__pyx_r = 0;
11479  __Pyx_RefNannyDeclarations
11480  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
11481  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
11482 
11483  /* function exit code */
11484  __Pyx_RefNannyFinishContext();
11485  return __pyx_r;
11486 }
11487 
11488 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
11489  PyObject *__pyx_r = NULL;
11490  __Pyx_TraceDeclarations
11491  __Pyx_RefNannyDeclarations
11492  PyObject *__pyx_t_1 = NULL;
11493  PyObject *__pyx_t_2 = NULL;
11494  int __pyx_lineno = 0;
11495  const char *__pyx_filename = NULL;
11496  int __pyx_clineno = 0;
11497  __Pyx_RefNannySetupContext("__getitem__", 0);
11498  __Pyx_TraceCall("__getitem__", __pyx_f[1], 237, 0, __PYX_ERR(1, 237, __pyx_L1_error));
11499 
11500  /* "View.MemoryView":238
11501  *
11502  * def __getitem__(self, item):
11503  * return self.memview[item] # <<<<<<<<<<<<<<
11504  *
11505  * def __setitem__(self, item, value):
11506  */
11507  __Pyx_TraceLine(238,0,__PYX_ERR(1, 238, __pyx_L1_error))
11508  __Pyx_XDECREF(__pyx_r);
11509  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 238, __pyx_L1_error)
11510  __Pyx_GOTREF(__pyx_t_1);
11511  __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 238, __pyx_L1_error)
11512  __Pyx_GOTREF(__pyx_t_2);
11513  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11514  __pyx_r = __pyx_t_2;
11515  __pyx_t_2 = 0;
11516  goto __pyx_L0;
11517 
11518  /* "View.MemoryView":237
11519  * return getattr(self.memview, attr)
11520  *
11521  * def __getitem__(self, item): # <<<<<<<<<<<<<<
11522  * return self.memview[item]
11523  *
11524  */
11525 
11526  /* function exit code */
11527  __pyx_L1_error:;
11528  __Pyx_XDECREF(__pyx_t_1);
11529  __Pyx_XDECREF(__pyx_t_2);
11530  __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11531  __pyx_r = NULL;
11532  __pyx_L0:;
11533  __Pyx_XGIVEREF(__pyx_r);
11534  __Pyx_TraceReturn(__pyx_r, 0);
11535  __Pyx_RefNannyFinishContext();
11536  return __pyx_r;
11537 }
11538 
11539 /* "View.MemoryView":240
11540  * return self.memview[item]
11541  *
11542  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
11543  * self.memview[item] = value
11544  *
11545  */
11546 
11547 /* Python wrapper */
11548 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
11549 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
11550  int __pyx_r;
11551  __Pyx_RefNannyDeclarations
11552  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
11553  __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
11554 
11555  /* function exit code */
11556  __Pyx_RefNannyFinishContext();
11557  return __pyx_r;
11558 }
11559 
11560 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
11561  int __pyx_r;
11562  __Pyx_TraceDeclarations
11563  __Pyx_RefNannyDeclarations
11564  PyObject *__pyx_t_1 = NULL;
11565  int __pyx_lineno = 0;
11566  const char *__pyx_filename = NULL;
11567  int __pyx_clineno = 0;
11568  __Pyx_RefNannySetupContext("__setitem__", 0);
11569  __Pyx_TraceCall("__setitem__", __pyx_f[1], 240, 0, __PYX_ERR(1, 240, __pyx_L1_error));
11570 
11571  /* "View.MemoryView":241
11572  *
11573  * def __setitem__(self, item, value):
11574  * self.memview[item] = value # <<<<<<<<<<<<<<
11575  *
11576  *
11577  */
11578  __Pyx_TraceLine(241,0,__PYX_ERR(1, 241, __pyx_L1_error))
11579  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 241, __pyx_L1_error)
11580  __Pyx_GOTREF(__pyx_t_1);
11581  if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 241, __pyx_L1_error)
11582  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11583 
11584  /* "View.MemoryView":240
11585  * return self.memview[item]
11586  *
11587  * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
11588  * self.memview[item] = value
11589  *
11590  */
11591 
11592  /* function exit code */
11593  __pyx_r = 0;
11594  goto __pyx_L0;
11595  __pyx_L1_error:;
11596  __Pyx_XDECREF(__pyx_t_1);
11597  __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11598  __pyx_r = -1;
11599  __pyx_L0:;
11600  __Pyx_TraceReturn(Py_None, 0);
11601  __Pyx_RefNannyFinishContext();
11602  return __pyx_r;
11603 }
11604 
11605 /* "(tree fragment)":1
11606  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11607  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11608  * def __setstate_cython__(self, __pyx_state):
11609  */
11610 
11611 /* Python wrapper */
11612 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
11613 static PyMethodDef __pyx_mdef___pyx_array_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0};
11614 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
11615  PyObject *__pyx_r = 0;
11616  __Pyx_RefNannyDeclarations
11617  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
11618  __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
11619 
11620  /* function exit code */
11621  __Pyx_RefNannyFinishContext();
11622  return __pyx_r;
11623 }
11624 
11625 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
11626  PyObject *__pyx_r = NULL;
11627  __Pyx_TraceDeclarations
11628  __Pyx_RefNannyDeclarations
11629  PyObject *__pyx_t_1 = NULL;
11630  int __pyx_lineno = 0;
11631  const char *__pyx_filename = NULL;
11632  int __pyx_clineno = 0;
11633  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
11634  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
11635 
11636  /* "(tree fragment)":2
11637  * def __reduce_cython__(self):
11638  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11639  * def __setstate_cython__(self, __pyx_state):
11640  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11641  */
11642  __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
11643  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
11644  __Pyx_GOTREF(__pyx_t_1);
11645  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11646  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11647  __PYX_ERR(1, 2, __pyx_L1_error)
11648 
11649  /* "(tree fragment)":1
11650  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
11651  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11652  * def __setstate_cython__(self, __pyx_state):
11653  */
11654 
11655  /* function exit code */
11656  __pyx_L1_error:;
11657  __Pyx_XDECREF(__pyx_t_1);
11658  __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11659  __pyx_r = NULL;
11660  __Pyx_XGIVEREF(__pyx_r);
11661  __Pyx_TraceReturn(__pyx_r, 0);
11662  __Pyx_RefNannyFinishContext();
11663  return __pyx_r;
11664 }
11665 
11666 /* "(tree fragment)":3
11667  * def __reduce_cython__(self):
11668  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11669  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11670  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11671  */
11672 
11673 /* Python wrapper */
11674 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
11675 static PyMethodDef __pyx_mdef___pyx_array_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0};
11676 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
11677  PyObject *__pyx_r = 0;
11678  __Pyx_RefNannyDeclarations
11679  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
11680  __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
11681 
11682  /* function exit code */
11683  __Pyx_RefNannyFinishContext();
11684  return __pyx_r;
11685 }
11686 
11687 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
11688  PyObject *__pyx_r = NULL;
11689  __Pyx_TraceDeclarations
11690  __Pyx_RefNannyDeclarations
11691  PyObject *__pyx_t_1 = NULL;
11692  int __pyx_lineno = 0;
11693  const char *__pyx_filename = NULL;
11694  int __pyx_clineno = 0;
11695  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
11696  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
11697 
11698  /* "(tree fragment)":4
11699  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11700  * def __setstate_cython__(self, __pyx_state):
11701  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
11702  */
11703  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
11704  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
11705  __Pyx_GOTREF(__pyx_t_1);
11706  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
11707  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11708  __PYX_ERR(1, 4, __pyx_L1_error)
11709 
11710  /* "(tree fragment)":3
11711  * def __reduce_cython__(self):
11712  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11713  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
11714  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
11715  */
11716 
11717  /* function exit code */
11718  __pyx_L1_error:;
11719  __Pyx_XDECREF(__pyx_t_1);
11720  __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11721  __pyx_r = NULL;
11722  __Pyx_XGIVEREF(__pyx_r);
11723  __Pyx_TraceReturn(__pyx_r, 0);
11724  __Pyx_RefNannyFinishContext();
11725  return __pyx_r;
11726 }
11727 
11728 /* "View.MemoryView":245
11729  *
11730  * @cname("__pyx_array_new")
11731  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
11732  * char *mode, char *buf):
11733  * cdef array result
11734  */
11735 
11736 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, char *__pyx_v_format, char *__pyx_v_mode, char *__pyx_v_buf) {
11737  struct __pyx_array_obj *__pyx_v_result = 0;
11738  struct __pyx_array_obj *__pyx_r = NULL;
11739  __Pyx_TraceDeclarations
11740  __Pyx_RefNannyDeclarations
11741  int __pyx_t_1;
11742  PyObject *__pyx_t_2 = NULL;
11743  PyObject *__pyx_t_3 = NULL;
11744  PyObject *__pyx_t_4 = NULL;
11745  PyObject *__pyx_t_5 = NULL;
11746  int __pyx_lineno = 0;
11747  const char *__pyx_filename = NULL;
11748  int __pyx_clineno = 0;
11749  __Pyx_RefNannySetupContext("array_cwrapper", 0);
11750  __Pyx_TraceCall("array_cwrapper", __pyx_f[1], 245, 0, __PYX_ERR(1, 245, __pyx_L1_error));
11751 
11752  /* "View.MemoryView":249
11753  * cdef array result
11754  *
11755  * if buf == NULL: # <<<<<<<<<<<<<<
11756  * result = array(shape, itemsize, format, mode.decode('ASCII'))
11757  * else:
11758  */
11759  __Pyx_TraceLine(249,0,__PYX_ERR(1, 249, __pyx_L1_error))
11760  __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
11761  if (__pyx_t_1) {
11762 
11763  /* "View.MemoryView":250
11764  *
11765  * if buf == NULL:
11766  * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
11767  * else:
11768  * result = array(shape, itemsize, format, mode.decode('ASCII'),
11769  */
11770  __Pyx_TraceLine(250,0,__PYX_ERR(1, 250, __pyx_L1_error))
11771  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 250, __pyx_L1_error)
11772  __Pyx_GOTREF(__pyx_t_2);
11773  __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 250, __pyx_L1_error)
11774  __Pyx_GOTREF(__pyx_t_3);
11775  __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 250, __pyx_L1_error)
11776  __Pyx_GOTREF(__pyx_t_4);
11777  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 250, __pyx_L1_error)
11778  __Pyx_GOTREF(__pyx_t_5);
11779  __Pyx_INCREF(__pyx_v_shape);
11780  __Pyx_GIVEREF(__pyx_v_shape);
11781  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
11782  __Pyx_GIVEREF(__pyx_t_2);
11783  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
11784  __Pyx_GIVEREF(__pyx_t_3);
11785  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
11786  __Pyx_GIVEREF(__pyx_t_4);
11787  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
11788  __pyx_t_2 = 0;
11789  __pyx_t_3 = 0;
11790  __pyx_t_4 = 0;
11791  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 250, __pyx_L1_error)
11792  __Pyx_GOTREF(__pyx_t_4);
11793  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11794  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
11795  __pyx_t_4 = 0;
11796 
11797  /* "View.MemoryView":249
11798  * cdef array result
11799  *
11800  * if buf == NULL: # <<<<<<<<<<<<<<
11801  * result = array(shape, itemsize, format, mode.decode('ASCII'))
11802  * else:
11803  */
11804  goto __pyx_L3;
11805  }
11806 
11807  /* "View.MemoryView":252
11808  * result = array(shape, itemsize, format, mode.decode('ASCII'))
11809  * else:
11810  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
11811  * allocate_buffer=False)
11812  * result.data = buf
11813  */
11814  __Pyx_TraceLine(252,0,__PYX_ERR(1, 252, __pyx_L1_error))
11815  /*else*/ {
11816  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 252, __pyx_L1_error)
11817  __Pyx_GOTREF(__pyx_t_4);
11818  __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 252, __pyx_L1_error)
11819  __Pyx_GOTREF(__pyx_t_5);
11820  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
11821  __Pyx_GOTREF(__pyx_t_3);
11822  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 252, __pyx_L1_error)
11823  __Pyx_GOTREF(__pyx_t_2);
11824  __Pyx_INCREF(__pyx_v_shape);
11825  __Pyx_GIVEREF(__pyx_v_shape);
11826  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
11827  __Pyx_GIVEREF(__pyx_t_4);
11828  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
11829  __Pyx_GIVEREF(__pyx_t_5);
11830  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
11831  __Pyx_GIVEREF(__pyx_t_3);
11832  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
11833  __pyx_t_4 = 0;
11834  __pyx_t_5 = 0;
11835  __pyx_t_3 = 0;
11836 
11837  /* "View.MemoryView":253
11838  * else:
11839  * result = array(shape, itemsize, format, mode.decode('ASCII'),
11840  * allocate_buffer=False) # <<<<<<<<<<<<<<
11841  * result.data = buf
11842  *
11843  */
11844  __Pyx_TraceLine(253,0,__PYX_ERR(1, 253, __pyx_L1_error))
11845  __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 253, __pyx_L1_error)
11846  __Pyx_GOTREF(__pyx_t_3);
11847  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 253, __pyx_L1_error)
11848 
11849  /* "View.MemoryView":252
11850  * result = array(shape, itemsize, format, mode.decode('ASCII'))
11851  * else:
11852  * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
11853  * allocate_buffer=False)
11854  * result.data = buf
11855  */
11856  __Pyx_TraceLine(252,0,__PYX_ERR(1, 252, __pyx_L1_error))
11857  __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 252, __pyx_L1_error)
11858  __Pyx_GOTREF(__pyx_t_5);
11859  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11860  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11861  __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
11862  __pyx_t_5 = 0;
11863 
11864  /* "View.MemoryView":254
11865  * result = array(shape, itemsize, format, mode.decode('ASCII'),
11866  * allocate_buffer=False)
11867  * result.data = buf # <<<<<<<<<<<<<<
11868  *
11869  * return result
11870  */
11871  __Pyx_TraceLine(254,0,__PYX_ERR(1, 254, __pyx_L1_error))
11872  __pyx_v_result->data = __pyx_v_buf;
11873  }
11874  __pyx_L3:;
11875 
11876  /* "View.MemoryView":256
11877  * result.data = buf
11878  *
11879  * return result # <<<<<<<<<<<<<<
11880  *
11881  *
11882  */
11883  __Pyx_TraceLine(256,0,__PYX_ERR(1, 256, __pyx_L1_error))
11884  __Pyx_XDECREF(((PyObject *)__pyx_r));
11885  __Pyx_INCREF(((PyObject *)__pyx_v_result));
11886  __pyx_r = __pyx_v_result;
11887  goto __pyx_L0;
11888 
11889  /* "View.MemoryView":245
11890  *
11891  * @cname("__pyx_array_new")
11892  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
11893  * char *mode, char *buf):
11894  * cdef array result
11895  */
11896 
11897  /* function exit code */
11898  __pyx_L1_error:;
11899  __Pyx_XDECREF(__pyx_t_2);
11900  __Pyx_XDECREF(__pyx_t_3);
11901  __Pyx_XDECREF(__pyx_t_4);
11902  __Pyx_XDECREF(__pyx_t_5);
11903  __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
11904  __pyx_r = 0;
11905  __pyx_L0:;
11906  __Pyx_XDECREF((PyObject *)__pyx_v_result);
11907  __Pyx_XGIVEREF((PyObject *)__pyx_r);
11908  __Pyx_TraceReturn(__pyx_r, 0);
11909  __Pyx_RefNannyFinishContext();
11910  return __pyx_r;
11911 }
11912 
11913 /* "View.MemoryView":282
11914  * cdef class Enum(object):
11915  * cdef object name
11916  * def __init__(self, name): # <<<<<<<<<<<<<<
11917  * self.name = name
11918  * def __repr__(self):
11919  */
11920 
11921 /* Python wrapper */
11922 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
11923 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
11924  PyObject *__pyx_v_name = 0;
11925  int __pyx_lineno = 0;
11926  const char *__pyx_filename = NULL;
11927  int __pyx_clineno = 0;
11928  int __pyx_r;
11929  __Pyx_RefNannyDeclarations
11930  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
11931  {
11932  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
11933  PyObject* values[1] = {0};
11934  if (unlikely(__pyx_kwds)) {
11935  Py_ssize_t kw_args;
11936  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
11937  switch (pos_args) {
11938  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11939  CYTHON_FALLTHROUGH;
11940  case 0: break;
11941  default: goto __pyx_L5_argtuple_error;
11942  }
11943  kw_args = PyDict_Size(__pyx_kwds);
11944  switch (pos_args) {
11945  case 0:
11946  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
11947  else goto __pyx_L5_argtuple_error;
11948  }
11949  if (unlikely(kw_args > 0)) {
11950  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 282, __pyx_L3_error)
11951  }
11952  } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
11953  goto __pyx_L5_argtuple_error;
11954  } else {
11955  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
11956  }
11957  __pyx_v_name = values[0];
11958  }
11959  goto __pyx_L4_argument_unpacking_done;
11960  __pyx_L5_argtuple_error:;
11961  __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 282, __pyx_L3_error)
11962  __pyx_L3_error:;
11963  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11964  __Pyx_RefNannyFinishContext();
11965  return -1;
11966  __pyx_L4_argument_unpacking_done:;
11967  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
11968 
11969  /* function exit code */
11970  __Pyx_RefNannyFinishContext();
11971  return __pyx_r;
11972 }
11973 
11974 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
11975  int __pyx_r;
11976  __Pyx_TraceDeclarations
11977  __Pyx_RefNannyDeclarations
11978  int __pyx_lineno = 0;
11979  const char *__pyx_filename = NULL;
11980  int __pyx_clineno = 0;
11981  __Pyx_RefNannySetupContext("__init__", 0);
11982  __Pyx_TraceCall("__init__", __pyx_f[1], 282, 0, __PYX_ERR(1, 282, __pyx_L1_error));
11983 
11984  /* "View.MemoryView":283
11985  * cdef object name
11986  * def __init__(self, name):
11987  * self.name = name # <<<<<<<<<<<<<<
11988  * def __repr__(self):
11989  * return self.name
11990  */
11991  __Pyx_TraceLine(283,0,__PYX_ERR(1, 283, __pyx_L1_error))
11992  __Pyx_INCREF(__pyx_v_name);
11993  __Pyx_GIVEREF(__pyx_v_name);
11994  __Pyx_GOTREF(__pyx_v_self->name);
11995  __Pyx_DECREF(__pyx_v_self->name);
11996  __pyx_v_self->name = __pyx_v_name;
11997 
11998  /* "View.MemoryView":282
11999  * cdef class Enum(object):
12000  * cdef object name
12001  * def __init__(self, name): # <<<<<<<<<<<<<<
12002  * self.name = name
12003  * def __repr__(self):
12004  */
12005 
12006  /* function exit code */
12007  __pyx_r = 0;
12008  goto __pyx_L0;
12009  __pyx_L1_error:;
12010  __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12011  __pyx_r = -1;
12012  __pyx_L0:;
12013  __Pyx_TraceReturn(Py_None, 0);
12014  __Pyx_RefNannyFinishContext();
12015  return __pyx_r;
12016 }
12017 
12018 /* "View.MemoryView":284
12019  * def __init__(self, name):
12020  * self.name = name
12021  * def __repr__(self): # <<<<<<<<<<<<<<
12022  * return self.name
12023  *
12024  */
12025 
12026 /* Python wrapper */
12027 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
12028 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
12029  PyObject *__pyx_r = 0;
12030  __Pyx_RefNannyDeclarations
12031  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
12032  __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
12033 
12034  /* function exit code */
12035  __Pyx_RefNannyFinishContext();
12036  return __pyx_r;
12037 }
12038 
12039 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
12040  PyObject *__pyx_r = NULL;
12041  __Pyx_TraceDeclarations
12042  __Pyx_RefNannyDeclarations
12043  int __pyx_lineno = 0;
12044  const char *__pyx_filename = NULL;
12045  int __pyx_clineno = 0;
12046  __Pyx_RefNannySetupContext("__repr__", 0);
12047  __Pyx_TraceCall("__repr__", __pyx_f[1], 284, 0, __PYX_ERR(1, 284, __pyx_L1_error));
12048 
12049  /* "View.MemoryView":285
12050  * self.name = name
12051  * def __repr__(self):
12052  * return self.name # <<<<<<<<<<<<<<
12053  *
12054  * cdef generic = Enum("<strided and direct or indirect>")
12055  */
12056  __Pyx_TraceLine(285,0,__PYX_ERR(1, 285, __pyx_L1_error))
12057  __Pyx_XDECREF(__pyx_r);
12058  __Pyx_INCREF(__pyx_v_self->name);
12059  __pyx_r = __pyx_v_self->name;
12060  goto __pyx_L0;
12061 
12062  /* "View.MemoryView":284
12063  * def __init__(self, name):
12064  * self.name = name
12065  * def __repr__(self): # <<<<<<<<<<<<<<
12066  * return self.name
12067  *
12068  */
12069 
12070  /* function exit code */
12071  __pyx_L1_error:;
12072  __Pyx_AddTraceback("View.MemoryView.Enum.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12073  __pyx_r = NULL;
12074  __pyx_L0:;
12075  __Pyx_XGIVEREF(__pyx_r);
12076  __Pyx_TraceReturn(__pyx_r, 0);
12077  __Pyx_RefNannyFinishContext();
12078  return __pyx_r;
12079 }
12080 
12081 /* "(tree fragment)":1
12082  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
12083  * cdef tuple state
12084  * cdef object _dict
12085  */
12086 
12087 /* Python wrapper */
12088 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
12089 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0};
12090 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12091  PyObject *__pyx_r = 0;
12092  __Pyx_RefNannyDeclarations
12093  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
12094  __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
12095 
12096  /* function exit code */
12097  __Pyx_RefNannyFinishContext();
12098  return __pyx_r;
12099 }
12100 
12101 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
12102  PyObject *__pyx_v_state = 0;
12103  PyObject *__pyx_v__dict = 0;
12104  int __pyx_v_use_setstate;
12105  PyObject *__pyx_r = NULL;
12106  __Pyx_TraceDeclarations
12107  __Pyx_RefNannyDeclarations
12108  PyObject *__pyx_t_1 = NULL;
12109  int __pyx_t_2;
12110  int __pyx_t_3;
12111  PyObject *__pyx_t_4 = NULL;
12112  PyObject *__pyx_t_5 = NULL;
12113  int __pyx_lineno = 0;
12114  const char *__pyx_filename = NULL;
12115  int __pyx_clineno = 0;
12116  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
12117  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
12118 
12119  /* "(tree fragment)":5
12120  * cdef object _dict
12121  * cdef bint use_setstate
12122  * state = (self.name,) # <<<<<<<<<<<<<<
12123  * _dict = getattr(self, '__dict__', None)
12124  * if _dict is not None:
12125  */
12126  __Pyx_TraceLine(5,0,__PYX_ERR(1, 5, __pyx_L1_error))
12127  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
12128  __Pyx_GOTREF(__pyx_t_1);
12129  __Pyx_INCREF(__pyx_v_self->name);
12130  __Pyx_GIVEREF(__pyx_v_self->name);
12131  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
12132  __pyx_v_state = ((PyObject*)__pyx_t_1);
12133  __pyx_t_1 = 0;
12134 
12135  /* "(tree fragment)":6
12136  * cdef bint use_setstate
12137  * state = (self.name,)
12138  * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
12139  * if _dict is not None:
12140  * state += (_dict,)
12141  */
12142  __Pyx_TraceLine(6,0,__PYX_ERR(1, 6, __pyx_L1_error))
12143  __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
12144  __Pyx_GOTREF(__pyx_t_1);
12145  __pyx_v__dict = __pyx_t_1;
12146  __pyx_t_1 = 0;
12147 
12148  /* "(tree fragment)":7
12149  * state = (self.name,)
12150  * _dict = getattr(self, '__dict__', None)
12151  * if _dict is not None: # <<<<<<<<<<<<<<
12152  * state += (_dict,)
12153  * use_setstate = True
12154  */
12155  __Pyx_TraceLine(7,0,__PYX_ERR(1, 7, __pyx_L1_error))
12156  __pyx_t_2 = (__pyx_v__dict != Py_None);
12157  __pyx_t_3 = (__pyx_t_2 != 0);
12158  if (__pyx_t_3) {
12159 
12160  /* "(tree fragment)":8
12161  * _dict = getattr(self, '__dict__', None)
12162  * if _dict is not None:
12163  * state += (_dict,) # <<<<<<<<<<<<<<
12164  * use_setstate = True
12165  * else:
12166  */
12167  __Pyx_TraceLine(8,0,__PYX_ERR(1, 8, __pyx_L1_error))
12168  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
12169  __Pyx_GOTREF(__pyx_t_1);
12170  __Pyx_INCREF(__pyx_v__dict);
12171  __Pyx_GIVEREF(__pyx_v__dict);
12172  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
12173  __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
12174  __Pyx_GOTREF(__pyx_t_4);
12175  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12176  __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
12177  __pyx_t_4 = 0;
12178 
12179  /* "(tree fragment)":9
12180  * if _dict is not None:
12181  * state += (_dict,)
12182  * use_setstate = True # <<<<<<<<<<<<<<
12183  * else:
12184  * use_setstate = self.name is not None
12185  */
12186  __Pyx_TraceLine(9,0,__PYX_ERR(1, 9, __pyx_L1_error))
12187  __pyx_v_use_setstate = 1;
12188 
12189  /* "(tree fragment)":7
12190  * state = (self.name,)
12191  * _dict = getattr(self, '__dict__', None)
12192  * if _dict is not None: # <<<<<<<<<<<<<<
12193  * state += (_dict,)
12194  * use_setstate = True
12195  */
12196  goto __pyx_L3;
12197  }
12198 
12199  /* "(tree fragment)":11
12200  * use_setstate = True
12201  * else:
12202  * use_setstate = self.name is not None # <<<<<<<<<<<<<<
12203  * if use_setstate:
12204  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
12205  */
12206  __Pyx_TraceLine(11,0,__PYX_ERR(1, 11, __pyx_L1_error))
12207  /*else*/ {
12208  __pyx_t_3 = (__pyx_v_self->name != Py_None);
12209  __pyx_v_use_setstate = __pyx_t_3;
12210  }
12211  __pyx_L3:;
12212 
12213  /* "(tree fragment)":12
12214  * else:
12215  * use_setstate = self.name is not None
12216  * if use_setstate: # <<<<<<<<<<<<<<
12217  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
12218  * else:
12219  */
12220  __Pyx_TraceLine(12,0,__PYX_ERR(1, 12, __pyx_L1_error))
12221  __pyx_t_3 = (__pyx_v_use_setstate != 0);
12222  if (__pyx_t_3) {
12223 
12224  /* "(tree fragment)":13
12225  * use_setstate = self.name is not None
12226  * if use_setstate:
12227  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
12228  * else:
12229  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
12230  */
12231  __Pyx_TraceLine(13,0,__PYX_ERR(1, 13, __pyx_L1_error))
12232  __Pyx_XDECREF(__pyx_r);
12233  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
12234  __Pyx_GOTREF(__pyx_t_4);
12235  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
12236  __Pyx_GOTREF(__pyx_t_1);
12237  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12238  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12239  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12240  __Pyx_INCREF(__pyx_int_184977713);
12241  __Pyx_GIVEREF(__pyx_int_184977713);
12242  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
12243  __Pyx_INCREF(Py_None);
12244  __Pyx_GIVEREF(Py_None);
12245  PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
12246  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
12247  __Pyx_GOTREF(__pyx_t_5);
12248  __Pyx_GIVEREF(__pyx_t_4);
12249  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12250  __Pyx_GIVEREF(__pyx_t_1);
12251  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
12252  __Pyx_INCREF(__pyx_v_state);
12253  __Pyx_GIVEREF(__pyx_v_state);
12254  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
12255  __pyx_t_4 = 0;
12256  __pyx_t_1 = 0;
12257  __pyx_r = __pyx_t_5;
12258  __pyx_t_5 = 0;
12259  goto __pyx_L0;
12260 
12261  /* "(tree fragment)":12
12262  * else:
12263  * use_setstate = self.name is not None
12264  * if use_setstate: # <<<<<<<<<<<<<<
12265  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
12266  * else:
12267  */
12268  }
12269 
12270  /* "(tree fragment)":15
12271  * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
12272  * else:
12273  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
12274  * def __setstate_cython__(self, __pyx_state):
12275  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
12276  */
12277  __Pyx_TraceLine(15,0,__PYX_ERR(1, 15, __pyx_L1_error))
12278  /*else*/ {
12279  __Pyx_XDECREF(__pyx_r);
12280  __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
12281  __Pyx_GOTREF(__pyx_t_5);
12282  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
12283  __Pyx_GOTREF(__pyx_t_1);
12284  __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12285  __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12286  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
12287  __Pyx_INCREF(__pyx_int_184977713);
12288  __Pyx_GIVEREF(__pyx_int_184977713);
12289  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
12290  __Pyx_INCREF(__pyx_v_state);
12291  __Pyx_GIVEREF(__pyx_v_state);
12292  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
12293  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
12294  __Pyx_GOTREF(__pyx_t_4);
12295  __Pyx_GIVEREF(__pyx_t_5);
12296  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
12297  __Pyx_GIVEREF(__pyx_t_1);
12298  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
12299  __pyx_t_5 = 0;
12300  __pyx_t_1 = 0;
12301  __pyx_r = __pyx_t_4;
12302  __pyx_t_4 = 0;
12303  goto __pyx_L0;
12304  }
12305 
12306  /* "(tree fragment)":1
12307  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
12308  * cdef tuple state
12309  * cdef object _dict
12310  */
12311 
12312  /* function exit code */
12313  __pyx_L1_error:;
12314  __Pyx_XDECREF(__pyx_t_1);
12315  __Pyx_XDECREF(__pyx_t_4);
12316  __Pyx_XDECREF(__pyx_t_5);
12317  __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12318  __pyx_r = NULL;
12319  __pyx_L0:;
12320  __Pyx_XDECREF(__pyx_v_state);
12321  __Pyx_XDECREF(__pyx_v__dict);
12322  __Pyx_XGIVEREF(__pyx_r);
12323  __Pyx_TraceReturn(__pyx_r, 0);
12324  __Pyx_RefNannyFinishContext();
12325  return __pyx_r;
12326 }
12327 
12328 /* "(tree fragment)":16
12329  * else:
12330  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
12331  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
12332  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
12333  */
12334 
12335 /* Python wrapper */
12336 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
12337 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0};
12338 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12339  PyObject *__pyx_r = 0;
12340  __Pyx_RefNannyDeclarations
12341  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
12342  __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
12343 
12344  /* function exit code */
12345  __Pyx_RefNannyFinishContext();
12346  return __pyx_r;
12347 }
12348 
12349 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
12350  PyObject *__pyx_r = NULL;
12351  __Pyx_TraceDeclarations
12352  __Pyx_RefNannyDeclarations
12353  PyObject *__pyx_t_1 = NULL;
12354  int __pyx_lineno = 0;
12355  const char *__pyx_filename = NULL;
12356  int __pyx_clineno = 0;
12357  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
12358  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 16, 0, __PYX_ERR(1, 16, __pyx_L1_error));
12359 
12360  /* "(tree fragment)":17
12361  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
12362  * def __setstate_cython__(self, __pyx_state):
12363  * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
12364  */
12365  __Pyx_TraceLine(17,0,__PYX_ERR(1, 17, __pyx_L1_error))
12366  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
12367  __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
12368  __Pyx_GOTREF(__pyx_t_1);
12369  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12370 
12371  /* "(tree fragment)":16
12372  * else:
12373  * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
12374  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
12375  * __pyx_unpickle_Enum__set_state(self, __pyx_state)
12376  */
12377 
12378  /* function exit code */
12379  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12380  goto __pyx_L0;
12381  __pyx_L1_error:;
12382  __Pyx_XDECREF(__pyx_t_1);
12383  __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12384  __pyx_r = NULL;
12385  __pyx_L0:;
12386  __Pyx_XGIVEREF(__pyx_r);
12387  __Pyx_TraceReturn(__pyx_r, 0);
12388  __Pyx_RefNannyFinishContext();
12389  return __pyx_r;
12390 }
12391 
12392 /* "View.MemoryView":299
12393  *
12394  * @cname('__pyx_align_pointer')
12395  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
12396  * "Align pointer memory on a given boundary"
12397  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
12398  */
12399 
12400 static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
12401  Py_intptr_t __pyx_v_aligned_p;
12402  size_t __pyx_v_offset;
12403  void *__pyx_r;
12404  __Pyx_TraceDeclarations
12405  int __pyx_t_1;
12406  int __pyx_lineno = 0;
12407  const char *__pyx_filename = NULL;
12408  int __pyx_clineno = 0;
12409  __Pyx_TraceCall("align_pointer", __pyx_f[1], 299, 1, __PYX_ERR(1, 299, __pyx_L1_error));
12410 
12411  /* "View.MemoryView":301
12412  * cdef void *align_pointer(void *memory, size_t alignment) nogil:
12413  * "Align pointer memory on a given boundary"
12414  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
12415  * cdef size_t offset
12416  *
12417  */
12418  __Pyx_TraceLine(301,1,__PYX_ERR(1, 301, __pyx_L1_error))
12419  __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
12420 
12421  /* "View.MemoryView":305
12422  *
12423  * with cython.cdivision(True):
12424  * offset = aligned_p % alignment # <<<<<<<<<<<<<<
12425  *
12426  * if offset > 0:
12427  */
12428  __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
12429 
12430  /* "View.MemoryView":307
12431  * offset = aligned_p % alignment
12432  *
12433  * if offset > 0: # <<<<<<<<<<<<<<
12434  * aligned_p += alignment - offset
12435  *
12436  */
12437  __Pyx_TraceLine(307,1,__PYX_ERR(1, 307, __pyx_L1_error))
12438  __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
12439  if (__pyx_t_1) {
12440 
12441  /* "View.MemoryView":308
12442  *
12443  * if offset > 0:
12444  * aligned_p += alignment - offset # <<<<<<<<<<<<<<
12445  *
12446  * return <void *> aligned_p
12447  */
12448  __Pyx_TraceLine(308,1,__PYX_ERR(1, 308, __pyx_L1_error))
12449  __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
12450 
12451  /* "View.MemoryView":307
12452  * offset = aligned_p % alignment
12453  *
12454  * if offset > 0: # <<<<<<<<<<<<<<
12455  * aligned_p += alignment - offset
12456  *
12457  */
12458  }
12459 
12460  /* "View.MemoryView":310
12461  * aligned_p += alignment - offset
12462  *
12463  * return <void *> aligned_p # <<<<<<<<<<<<<<
12464  *
12465  *
12466  */
12467  __Pyx_TraceLine(310,1,__PYX_ERR(1, 310, __pyx_L1_error))
12468  __pyx_r = ((void *)__pyx_v_aligned_p);
12469  goto __pyx_L0;
12470 
12471  /* "View.MemoryView":299
12472  *
12473  * @cname('__pyx_align_pointer')
12474  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
12475  * "Align pointer memory on a given boundary"
12476  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
12477  */
12478 
12479  /* function exit code */
12480  __pyx_L1_error:;
12481  __Pyx_WriteUnraisable("View.MemoryView.align_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
12482  __pyx_r = 0;
12483  __pyx_L0:;
12484  __Pyx_TraceReturn(Py_None, 1);
12485  return __pyx_r;
12486 }
12487 
12488 /* "View.MemoryView":346
12489  * cdef __Pyx_TypeInfo *typeinfo
12490  *
12491  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
12492  * self.obj = obj
12493  * self.flags = flags
12494  */
12495 
12496 /* Python wrapper */
12497 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
12498 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
12499  PyObject *__pyx_v_obj = 0;
12500  int __pyx_v_flags;
12501  int __pyx_v_dtype_is_object;
12502  int __pyx_lineno = 0;
12503  const char *__pyx_filename = NULL;
12504  int __pyx_clineno = 0;
12505  int __pyx_r;
12506  __Pyx_RefNannyDeclarations
12507  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
12508  {
12509  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
12510  PyObject* values[3] = {0,0,0};
12511  if (unlikely(__pyx_kwds)) {
12512  Py_ssize_t kw_args;
12513  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
12514  switch (pos_args) {
12515  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12516  CYTHON_FALLTHROUGH;
12517  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12518  CYTHON_FALLTHROUGH;
12519  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12520  CYTHON_FALLTHROUGH;
12521  case 0: break;
12522  default: goto __pyx_L5_argtuple_error;
12523  }
12524  kw_args = PyDict_Size(__pyx_kwds);
12525  switch (pos_args) {
12526  case 0:
12527  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
12528  else goto __pyx_L5_argtuple_error;
12529  CYTHON_FALLTHROUGH;
12530  case 1:
12531  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
12532  else {
12533  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 346, __pyx_L3_error)
12534  }
12535  CYTHON_FALLTHROUGH;
12536  case 2:
12537  if (kw_args > 0) {
12538  PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
12539  if (value) { values[2] = value; kw_args--; }
12540  }
12541  }
12542  if (unlikely(kw_args > 0)) {
12543  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(1, 346, __pyx_L3_error)
12544  }
12545  } else {
12546  switch (PyTuple_GET_SIZE(__pyx_args)) {
12547  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
12548  CYTHON_FALLTHROUGH;
12549  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
12550  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
12551  break;
12552  default: goto __pyx_L5_argtuple_error;
12553  }
12554  }
12555  __pyx_v_obj = values[0];
12556  __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 346, __pyx_L3_error)
12557  if (values[2]) {
12558  __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 346, __pyx_L3_error)
12559  } else {
12560  __pyx_v_dtype_is_object = ((int)0);
12561  }
12562  }
12563  goto __pyx_L4_argument_unpacking_done;
12564  __pyx_L5_argtuple_error:;
12565  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 346, __pyx_L3_error)
12566  __pyx_L3_error:;
12567  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12568  __Pyx_RefNannyFinishContext();
12569  return -1;
12570  __pyx_L4_argument_unpacking_done:;
12571  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
12572 
12573  /* function exit code */
12574  __Pyx_RefNannyFinishContext();
12575  return __pyx_r;
12576 }
12577 
12578 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj, int __pyx_v_flags, int __pyx_v_dtype_is_object) {
12579  int __pyx_r;
12580  __Pyx_TraceDeclarations
12581  __Pyx_RefNannyDeclarations
12582  int __pyx_t_1;
12583  int __pyx_t_2;
12584  int __pyx_t_3;
12585  int __pyx_t_4;
12586  int __pyx_lineno = 0;
12587  const char *__pyx_filename = NULL;
12588  int __pyx_clineno = 0;
12589  __Pyx_RefNannySetupContext("__cinit__", 0);
12590  __Pyx_TraceCall("__cinit__", __pyx_f[1], 346, 0, __PYX_ERR(1, 346, __pyx_L1_error));
12591 
12592  /* "View.MemoryView":347
12593  *
12594  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
12595  * self.obj = obj # <<<<<<<<<<<<<<
12596  * self.flags = flags
12597  * if type(self) is memoryview or obj is not None:
12598  */
12599  __Pyx_TraceLine(347,0,__PYX_ERR(1, 347, __pyx_L1_error))
12600  __Pyx_INCREF(__pyx_v_obj);
12601  __Pyx_GIVEREF(__pyx_v_obj);
12602  __Pyx_GOTREF(__pyx_v_self->obj);
12603  __Pyx_DECREF(__pyx_v_self->obj);
12604  __pyx_v_self->obj = __pyx_v_obj;
12605 
12606  /* "View.MemoryView":348
12607  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
12608  * self.obj = obj
12609  * self.flags = flags # <<<<<<<<<<<<<<
12610  * if type(self) is memoryview or obj is not None:
12611  * __Pyx_GetBuffer(obj, &self.view, flags)
12612  */
12613  __Pyx_TraceLine(348,0,__PYX_ERR(1, 348, __pyx_L1_error))
12614  __pyx_v_self->flags = __pyx_v_flags;
12615 
12616  /* "View.MemoryView":349
12617  * self.obj = obj
12618  * self.flags = flags
12619  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
12620  * __Pyx_GetBuffer(obj, &self.view, flags)
12621  * if <PyObject *> self.view.obj == NULL:
12622  */
12623  __Pyx_TraceLine(349,0,__PYX_ERR(1, 349, __pyx_L1_error))
12624  __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
12625  __pyx_t_3 = (__pyx_t_2 != 0);
12626  if (!__pyx_t_3) {
12627  } else {
12628  __pyx_t_1 = __pyx_t_3;
12629  goto __pyx_L4_bool_binop_done;
12630  }
12631  __pyx_t_3 = (__pyx_v_obj != Py_None);
12632  __pyx_t_2 = (__pyx_t_3 != 0);
12633  __pyx_t_1 = __pyx_t_2;
12634  __pyx_L4_bool_binop_done:;
12635  if (__pyx_t_1) {
12636 
12637  /* "View.MemoryView":350
12638  * self.flags = flags
12639  * if type(self) is memoryview or obj is not None:
12640  * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
12641  * if <PyObject *> self.view.obj == NULL:
12642  * (<__pyx_buffer *> &self.view).obj = Py_None
12643  */
12644  __Pyx_TraceLine(350,0,__PYX_ERR(1, 350, __pyx_L1_error))
12645  __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 350, __pyx_L1_error)
12646 
12647  /* "View.MemoryView":351
12648  * if type(self) is memoryview or obj is not None:
12649  * __Pyx_GetBuffer(obj, &self.view, flags)
12650  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
12651  * (<__pyx_buffer *> &self.view).obj = Py_None
12652  * Py_INCREF(Py_None)
12653  */
12654  __Pyx_TraceLine(351,0,__PYX_ERR(1, 351, __pyx_L1_error))
12655  __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
12656  if (__pyx_t_1) {
12657 
12658  /* "View.MemoryView":352
12659  * __Pyx_GetBuffer(obj, &self.view, flags)
12660  * if <PyObject *> self.view.obj == NULL:
12661  * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
12662  * Py_INCREF(Py_None)
12663  *
12664  */
12665  __Pyx_TraceLine(352,0,__PYX_ERR(1, 352, __pyx_L1_error))
12666  ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
12667 
12668  /* "View.MemoryView":353
12669  * if <PyObject *> self.view.obj == NULL:
12670  * (<__pyx_buffer *> &self.view).obj = Py_None
12671  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
12672  *
12673  * if not __PYX_CYTHON_ATOMICS_ENABLED():
12674  */
12675  __Pyx_TraceLine(353,0,__PYX_ERR(1, 353, __pyx_L1_error))
12676  Py_INCREF(Py_None);
12677 
12678  /* "View.MemoryView":351
12679  * if type(self) is memoryview or obj is not None:
12680  * __Pyx_GetBuffer(obj, &self.view, flags)
12681  * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
12682  * (<__pyx_buffer *> &self.view).obj = Py_None
12683  * Py_INCREF(Py_None)
12684  */
12685  }
12686 
12687  /* "View.MemoryView":349
12688  * self.obj = obj
12689  * self.flags = flags
12690  * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
12691  * __Pyx_GetBuffer(obj, &self.view, flags)
12692  * if <PyObject *> self.view.obj == NULL:
12693  */
12694  }
12695 
12696  /* "View.MemoryView":355
12697  * Py_INCREF(Py_None)
12698  *
12699  * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<<
12700  * global __pyx_memoryview_thread_locks_used
12701  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
12702  */
12703  __Pyx_TraceLine(355,0,__PYX_ERR(1, 355, __pyx_L1_error))
12704  __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0);
12705  if (__pyx_t_1) {
12706 
12707  /* "View.MemoryView":357
12708  * if not __PYX_CYTHON_ATOMICS_ENABLED():
12709  * global __pyx_memoryview_thread_locks_used
12710  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
12711  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
12712  * __pyx_memoryview_thread_locks_used += 1
12713  */
12714  __Pyx_TraceLine(357,0,__PYX_ERR(1, 357, __pyx_L1_error))
12715  __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
12716  if (__pyx_t_1) {
12717 
12718  /* "View.MemoryView":358
12719  * global __pyx_memoryview_thread_locks_used
12720  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
12721  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
12722  * __pyx_memoryview_thread_locks_used += 1
12723  * if self.lock is NULL:
12724  */
12725  __Pyx_TraceLine(358,0,__PYX_ERR(1, 358, __pyx_L1_error))
12726  __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
12727 
12728  /* "View.MemoryView":359
12729  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
12730  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
12731  * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
12732  * if self.lock is NULL:
12733  * self.lock = PyThread_allocate_lock()
12734  */
12735  __Pyx_TraceLine(359,0,__PYX_ERR(1, 359, __pyx_L1_error))
12736  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
12737 
12738  /* "View.MemoryView":357
12739  * if not __PYX_CYTHON_ATOMICS_ENABLED():
12740  * global __pyx_memoryview_thread_locks_used
12741  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
12742  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
12743  * __pyx_memoryview_thread_locks_used += 1
12744  */
12745  }
12746 
12747  /* "View.MemoryView":360
12748  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
12749  * __pyx_memoryview_thread_locks_used += 1
12750  * if self.lock is NULL: # <<<<<<<<<<<<<<
12751  * self.lock = PyThread_allocate_lock()
12752  * if self.lock is NULL:
12753  */
12754  __Pyx_TraceLine(360,0,__PYX_ERR(1, 360, __pyx_L1_error))
12755  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
12756  if (__pyx_t_1) {
12757 
12758  /* "View.MemoryView":361
12759  * __pyx_memoryview_thread_locks_used += 1
12760  * if self.lock is NULL:
12761  * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
12762  * if self.lock is NULL:
12763  * raise MemoryError
12764  */
12765  __Pyx_TraceLine(361,0,__PYX_ERR(1, 361, __pyx_L1_error))
12766  __pyx_v_self->lock = PyThread_allocate_lock();
12767 
12768  /* "View.MemoryView":362
12769  * if self.lock is NULL:
12770  * self.lock = PyThread_allocate_lock()
12771  * if self.lock is NULL: # <<<<<<<<<<<<<<
12772  * raise MemoryError
12773  *
12774  */
12775  __Pyx_TraceLine(362,0,__PYX_ERR(1, 362, __pyx_L1_error))
12776  __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
12777  if (unlikely(__pyx_t_1)) {
12778 
12779  /* "View.MemoryView":363
12780  * self.lock = PyThread_allocate_lock()
12781  * if self.lock is NULL:
12782  * raise MemoryError # <<<<<<<<<<<<<<
12783  *
12784  * if flags & PyBUF_FORMAT:
12785  */
12786  __Pyx_TraceLine(363,0,__PYX_ERR(1, 363, __pyx_L1_error))
12787  PyErr_NoMemory(); __PYX_ERR(1, 363, __pyx_L1_error)
12788 
12789  /* "View.MemoryView":362
12790  * if self.lock is NULL:
12791  * self.lock = PyThread_allocate_lock()
12792  * if self.lock is NULL: # <<<<<<<<<<<<<<
12793  * raise MemoryError
12794  *
12795  */
12796  }
12797 
12798  /* "View.MemoryView":360
12799  * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
12800  * __pyx_memoryview_thread_locks_used += 1
12801  * if self.lock is NULL: # <<<<<<<<<<<<<<
12802  * self.lock = PyThread_allocate_lock()
12803  * if self.lock is NULL:
12804  */
12805  }
12806 
12807  /* "View.MemoryView":355
12808  * Py_INCREF(Py_None)
12809  *
12810  * if not __PYX_CYTHON_ATOMICS_ENABLED(): # <<<<<<<<<<<<<<
12811  * global __pyx_memoryview_thread_locks_used
12812  * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
12813  */
12814  }
12815 
12816  /* "View.MemoryView":365
12817  * raise MemoryError
12818  *
12819  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
12820  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
12821  * else:
12822  */
12823  __Pyx_TraceLine(365,0,__PYX_ERR(1, 365, __pyx_L1_error))
12824  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12825  if (__pyx_t_1) {
12826 
12827  /* "View.MemoryView":366
12828  *
12829  * if flags & PyBUF_FORMAT:
12830  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
12831  * else:
12832  * self.dtype_is_object = dtype_is_object
12833  */
12834  __Pyx_TraceLine(366,0,__PYX_ERR(1, 366, __pyx_L1_error))
12835  __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
12836  if (__pyx_t_2) {
12837  } else {
12838  __pyx_t_1 = __pyx_t_2;
12839  goto __pyx_L12_bool_binop_done;
12840  }
12841  __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
12842  __pyx_t_1 = __pyx_t_2;
12843  __pyx_L12_bool_binop_done:;
12844  __pyx_v_self->dtype_is_object = __pyx_t_1;
12845 
12846  /* "View.MemoryView":365
12847  * raise MemoryError
12848  *
12849  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
12850  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
12851  * else:
12852  */
12853  goto __pyx_L11;
12854  }
12855 
12856  /* "View.MemoryView":368
12857  * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
12858  * else:
12859  * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
12860  *
12861  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
12862  */
12863  __Pyx_TraceLine(368,0,__PYX_ERR(1, 368, __pyx_L1_error))
12864  /*else*/ {
12865  __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
12866  }
12867  __pyx_L11:;
12868 
12869  /* "View.MemoryView":370
12870  * self.dtype_is_object = dtype_is_object
12871  *
12872  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
12873  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
12874  * self.typeinfo = NULL
12875  */
12876  __Pyx_TraceLine(370,0,__PYX_ERR(1, 370, __pyx_L1_error))
12877  __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
12878 
12879  /* "View.MemoryView":372
12880  * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
12881  * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
12882  * self.typeinfo = NULL # <<<<<<<<<<<<<<
12883  *
12884  * def __dealloc__(memoryview self):
12885  */
12886  __Pyx_TraceLine(372,0,__PYX_ERR(1, 372, __pyx_L1_error))
12887  __pyx_v_self->typeinfo = NULL;
12888 
12889  /* "View.MemoryView":346
12890  * cdef __Pyx_TypeInfo *typeinfo
12891  *
12892  * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
12893  * self.obj = obj
12894  * self.flags = flags
12895  */
12896 
12897  /* function exit code */
12898  __pyx_r = 0;
12899  goto __pyx_L0;
12900  __pyx_L1_error:;
12901  __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12902  __pyx_r = -1;
12903  __pyx_L0:;
12904  __Pyx_TraceReturn(Py_None, 0);
12905  __Pyx_RefNannyFinishContext();
12906  return __pyx_r;
12907 }
12908 
12909 /* "View.MemoryView":374
12910  * self.typeinfo = NULL
12911  *
12912  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
12913  * if self.obj is not None:
12914  * __Pyx_ReleaseBuffer(&self.view)
12915  */
12916 
12917 /* Python wrapper */
12918 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
12919 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
12920  __Pyx_RefNannyDeclarations
12921  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
12922  __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
12923 
12924  /* function exit code */
12925  __Pyx_RefNannyFinishContext();
12926 }
12927 
12928 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
12929  int __pyx_v_i;
12930  __Pyx_TraceDeclarations
12931  __Pyx_RefNannyDeclarations
12932  int __pyx_t_1;
12933  int __pyx_t_2;
12934  int __pyx_t_3;
12935  int __pyx_t_4;
12936  int __pyx_t_5;
12937  PyThread_type_lock __pyx_t_6;
12938  PyThread_type_lock __pyx_t_7;
12939  int __pyx_lineno = 0;
12940  const char *__pyx_filename = NULL;
12941  int __pyx_clineno = 0;
12942  __Pyx_RefNannySetupContext("__dealloc__", 0);
12943  __Pyx_TraceCall("__dealloc__", __pyx_f[1], 374, 0, __PYX_ERR(1, 374, __pyx_L1_error));
12944 
12945  /* "View.MemoryView":375
12946  *
12947  * def __dealloc__(memoryview self):
12948  * if self.obj is not None: # <<<<<<<<<<<<<<
12949  * __Pyx_ReleaseBuffer(&self.view)
12950  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
12951  */
12952  __Pyx_TraceLine(375,0,__PYX_ERR(1, 375, __pyx_L1_error))
12953  __pyx_t_1 = (__pyx_v_self->obj != Py_None);
12954  __pyx_t_2 = (__pyx_t_1 != 0);
12955  if (__pyx_t_2) {
12956 
12957  /* "View.MemoryView":376
12958  * def __dealloc__(memoryview self):
12959  * if self.obj is not None:
12960  * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
12961  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
12962  *
12963  */
12964  __Pyx_TraceLine(376,0,__PYX_ERR(1, 376, __pyx_L1_error))
12965  __Pyx_ReleaseBuffer((&__pyx_v_self->view));
12966 
12967  /* "View.MemoryView":375
12968  *
12969  * def __dealloc__(memoryview self):
12970  * if self.obj is not None: # <<<<<<<<<<<<<<
12971  * __Pyx_ReleaseBuffer(&self.view)
12972  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
12973  */
12974  goto __pyx_L3;
12975  }
12976 
12977  /* "View.MemoryView":377
12978  * if self.obj is not None:
12979  * __Pyx_ReleaseBuffer(&self.view)
12980  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
12981  *
12982  * (<__pyx_buffer *> &self.view).obj = NULL
12983  */
12984  __Pyx_TraceLine(377,0,__PYX_ERR(1, 377, __pyx_L1_error))
12985  __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
12986  if (__pyx_t_2) {
12987 
12988  /* "View.MemoryView":379
12989  * elif (<__pyx_buffer *> &self.view).obj == Py_None:
12990  *
12991  * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
12992  * Py_DECREF(Py_None)
12993  *
12994  */
12995  __Pyx_TraceLine(379,0,__PYX_ERR(1, 379, __pyx_L1_error))
12996  ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
12997 
12998  /* "View.MemoryView":380
12999  *
13000  * (<__pyx_buffer *> &self.view).obj = NULL
13001  * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
13002  *
13003  * cdef int i
13004  */
13005  __Pyx_TraceLine(380,0,__PYX_ERR(1, 380, __pyx_L1_error))
13006  Py_DECREF(Py_None);
13007 
13008  /* "View.MemoryView":377
13009  * if self.obj is not None:
13010  * __Pyx_ReleaseBuffer(&self.view)
13011  * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
13012  *
13013  * (<__pyx_buffer *> &self.view).obj = NULL
13014  */
13015  }
13016  __pyx_L3:;
13017 
13018  /* "View.MemoryView":384
13019  * cdef int i
13020  * global __pyx_memoryview_thread_locks_used
13021  * if self.lock != NULL: # <<<<<<<<<<<<<<
13022  * for i in range(__pyx_memoryview_thread_locks_used):
13023  * if __pyx_memoryview_thread_locks[i] is self.lock:
13024  */
13025  __Pyx_TraceLine(384,0,__PYX_ERR(1, 384, __pyx_L1_error))
13026  __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
13027  if (__pyx_t_2) {
13028 
13029  /* "View.MemoryView":385
13030  * global __pyx_memoryview_thread_locks_used
13031  * if self.lock != NULL:
13032  * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
13033  * if __pyx_memoryview_thread_locks[i] is self.lock:
13034  * __pyx_memoryview_thread_locks_used -= 1
13035  */
13036  __Pyx_TraceLine(385,0,__PYX_ERR(1, 385, __pyx_L1_error))
13037  __pyx_t_3 = __pyx_memoryview_thread_locks_used;
13038  __pyx_t_4 = __pyx_t_3;
13039  for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
13040  __pyx_v_i = __pyx_t_5;
13041 
13042  /* "View.MemoryView":386
13043  * if self.lock != NULL:
13044  * for i in range(__pyx_memoryview_thread_locks_used):
13045  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
13046  * __pyx_memoryview_thread_locks_used -= 1
13047  * if i != __pyx_memoryview_thread_locks_used:
13048  */
13049  __Pyx_TraceLine(386,0,__PYX_ERR(1, 386, __pyx_L1_error))
13050  __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
13051  if (__pyx_t_2) {
13052 
13053  /* "View.MemoryView":387
13054  * for i in range(__pyx_memoryview_thread_locks_used):
13055  * if __pyx_memoryview_thread_locks[i] is self.lock:
13056  * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
13057  * if i != __pyx_memoryview_thread_locks_used:
13058  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
13059  */
13060  __Pyx_TraceLine(387,0,__PYX_ERR(1, 387, __pyx_L1_error))
13061  __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
13062 
13063  /* "View.MemoryView":388
13064  * if __pyx_memoryview_thread_locks[i] is self.lock:
13065  * __pyx_memoryview_thread_locks_used -= 1
13066  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
13067  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
13068  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
13069  */
13070  __Pyx_TraceLine(388,0,__PYX_ERR(1, 388, __pyx_L1_error))
13071  __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
13072  if (__pyx_t_2) {
13073 
13074  /* "View.MemoryView":390
13075  * if i != __pyx_memoryview_thread_locks_used:
13076  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
13077  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
13078  * break
13079  * else:
13080  */
13081  __Pyx_TraceLine(390,0,__PYX_ERR(1, 390, __pyx_L1_error))
13082  __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
13083  __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
13084 
13085  /* "View.MemoryView":389
13086  * __pyx_memoryview_thread_locks_used -= 1
13087  * if i != __pyx_memoryview_thread_locks_used:
13088  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
13089  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
13090  * break
13091  */
13092  __Pyx_TraceLine(389,0,__PYX_ERR(1, 389, __pyx_L1_error))
13093  (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
13094  (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
13095 
13096  /* "View.MemoryView":388
13097  * if __pyx_memoryview_thread_locks[i] is self.lock:
13098  * __pyx_memoryview_thread_locks_used -= 1
13099  * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
13100  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
13101  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
13102  */
13103  }
13104 
13105  /* "View.MemoryView":391
13106  * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
13107  * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
13108  * break # <<<<<<<<<<<<<<
13109  * else:
13110  * PyThread_free_lock(self.lock)
13111  */
13112  __Pyx_TraceLine(391,0,__PYX_ERR(1, 391, __pyx_L1_error))
13113  goto __pyx_L6_break;
13114 
13115  /* "View.MemoryView":386
13116  * if self.lock != NULL:
13117  * for i in range(__pyx_memoryview_thread_locks_used):
13118  * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
13119  * __pyx_memoryview_thread_locks_used -= 1
13120  * if i != __pyx_memoryview_thread_locks_used:
13121  */
13122  }
13123  }
13124  /*else*/ {
13125 
13126  /* "View.MemoryView":393
13127  * break
13128  * else:
13129  * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
13130  *
13131  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
13132  */
13133  __Pyx_TraceLine(393,0,__PYX_ERR(1, 393, __pyx_L1_error))
13134  PyThread_free_lock(__pyx_v_self->lock);
13135  }
13136  __pyx_L6_break:;
13137 
13138  /* "View.MemoryView":384
13139  * cdef int i
13140  * global __pyx_memoryview_thread_locks_used
13141  * if self.lock != NULL: # <<<<<<<<<<<<<<
13142  * for i in range(__pyx_memoryview_thread_locks_used):
13143  * if __pyx_memoryview_thread_locks[i] is self.lock:
13144  */
13145  }
13146 
13147  /* "View.MemoryView":374
13148  * self.typeinfo = NULL
13149  *
13150  * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
13151  * if self.obj is not None:
13152  * __Pyx_ReleaseBuffer(&self.view)
13153  */
13154 
13155  /* function exit code */
13156  goto __pyx_L0;
13157  __pyx_L1_error:;
13158  __Pyx_WriteUnraisable("View.MemoryView.memoryview.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13159  __pyx_L0:;
13160  __Pyx_TraceReturn(Py_None, 0);
13161  __Pyx_RefNannyFinishContext();
13162 }
13163 
13164 /* "View.MemoryView":395
13165  * PyThread_free_lock(self.lock)
13166  *
13167  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
13168  * cdef Py_ssize_t dim
13169  * cdef char *itemp = <char *> self.view.buf
13170  */
13171 
13172 static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
13173  Py_ssize_t __pyx_v_dim;
13174  char *__pyx_v_itemp;
13175  PyObject *__pyx_v_idx = NULL;
13176  char *__pyx_r;
13177  __Pyx_TraceDeclarations
13178  __Pyx_RefNannyDeclarations
13179  Py_ssize_t __pyx_t_1;
13180  PyObject *__pyx_t_2 = NULL;
13181  Py_ssize_t __pyx_t_3;
13182  PyObject *(*__pyx_t_4)(PyObject *);
13183  PyObject *__pyx_t_5 = NULL;
13184  Py_ssize_t __pyx_t_6;
13185  char *__pyx_t_7;
13186  int __pyx_lineno = 0;
13187  const char *__pyx_filename = NULL;
13188  int __pyx_clineno = 0;
13189  __Pyx_RefNannySetupContext("get_item_pointer", 0);
13190  __Pyx_TraceCall("get_item_pointer", __pyx_f[1], 395, 0, __PYX_ERR(1, 395, __pyx_L1_error));
13191 
13192  /* "View.MemoryView":397
13193  * cdef char *get_item_pointer(memoryview self, object index) except NULL:
13194  * cdef Py_ssize_t dim
13195  * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
13196  *
13197  * for dim, idx in enumerate(index):
13198  */
13199  __Pyx_TraceLine(397,0,__PYX_ERR(1, 397, __pyx_L1_error))
13200  __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
13201 
13202  /* "View.MemoryView":399
13203  * cdef char *itemp = <char *> self.view.buf
13204  *
13205  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
13206  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
13207  *
13208  */
13209  __Pyx_TraceLine(399,0,__PYX_ERR(1, 399, __pyx_L1_error))
13210  __pyx_t_1 = 0;
13211  if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
13212  __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
13213  __pyx_t_4 = NULL;
13214  } else {
13215  __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 399, __pyx_L1_error)
13216  __Pyx_GOTREF(__pyx_t_2);
13217  __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 399, __pyx_L1_error)
13218  }
13219  for (;;) {
13220  if (likely(!__pyx_t_4)) {
13221  if (likely(PyList_CheckExact(__pyx_t_2))) {
13222  if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
13223  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13224  __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 399, __pyx_L1_error)
13225  #else
13226  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 399, __pyx_L1_error)
13227  __Pyx_GOTREF(__pyx_t_5);
13228  #endif
13229  } else {
13230  if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
13231  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13232  __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(1, 399, __pyx_L1_error)
13233  #else
13234  __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 399, __pyx_L1_error)
13235  __Pyx_GOTREF(__pyx_t_5);
13236  #endif
13237  }
13238  } else {
13239  __pyx_t_5 = __pyx_t_4(__pyx_t_2);
13240  if (unlikely(!__pyx_t_5)) {
13241  PyObject* exc_type = PyErr_Occurred();
13242  if (exc_type) {
13243  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13244  else __PYX_ERR(1, 399, __pyx_L1_error)
13245  }
13246  break;
13247  }
13248  __Pyx_GOTREF(__pyx_t_5);
13249  }
13250  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
13251  __pyx_t_5 = 0;
13252  __pyx_v_dim = __pyx_t_1;
13253  __pyx_t_1 = (__pyx_t_1 + 1);
13254 
13255  /* "View.MemoryView":400
13256  *
13257  * for dim, idx in enumerate(index):
13258  * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
13259  *
13260  * return itemp
13261  */
13262  __Pyx_TraceLine(400,0,__PYX_ERR(1, 400, __pyx_L1_error))
13263  __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 400, __pyx_L1_error)
13264  __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(1, 400, __pyx_L1_error)
13265  __pyx_v_itemp = __pyx_t_7;
13266 
13267  /* "View.MemoryView":399
13268  * cdef char *itemp = <char *> self.view.buf
13269  *
13270  * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
13271  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
13272  *
13273  */
13274  __Pyx_TraceLine(399,0,__PYX_ERR(1, 399, __pyx_L1_error))
13275  }
13276  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13277 
13278  /* "View.MemoryView":402
13279  * itemp = pybuffer_index(&self.view, itemp, idx, dim)
13280  *
13281  * return itemp # <<<<<<<<<<<<<<
13282  *
13283  *
13284  */
13285  __Pyx_TraceLine(402,0,__PYX_ERR(1, 402, __pyx_L1_error))
13286  __pyx_r = __pyx_v_itemp;
13287  goto __pyx_L0;
13288 
13289  /* "View.MemoryView":395
13290  * PyThread_free_lock(self.lock)
13291  *
13292  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
13293  * cdef Py_ssize_t dim
13294  * cdef char *itemp = <char *> self.view.buf
13295  */
13296 
13297  /* function exit code */
13298  __pyx_L1_error:;
13299  __Pyx_XDECREF(__pyx_t_2);
13300  __Pyx_XDECREF(__pyx_t_5);
13301  __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
13302  __pyx_r = NULL;
13303  __pyx_L0:;
13304  __Pyx_XDECREF(__pyx_v_idx);
13305  __Pyx_TraceReturn(Py_None, 0);
13306  __Pyx_RefNannyFinishContext();
13307  return __pyx_r;
13308 }
13309 
13310 /* "View.MemoryView":405
13311  *
13312  *
13313  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
13314  * if index is Ellipsis:
13315  * return self
13316  */
13317 
13318 /* Python wrapper */
13319 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
13320 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
13321  PyObject *__pyx_r = 0;
13322  __Pyx_RefNannyDeclarations
13323  __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
13324  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
13325 
13326  /* function exit code */
13327  __Pyx_RefNannyFinishContext();
13328  return __pyx_r;
13329 }
13330 
13331 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
13332  PyObject *__pyx_v_have_slices = NULL;
13333  PyObject *__pyx_v_indices = NULL;
13334  char *__pyx_v_itemp;
13335  PyObject *__pyx_r = NULL;
13336  __Pyx_TraceDeclarations
13337  __Pyx_RefNannyDeclarations
13338  int __pyx_t_1;
13339  int __pyx_t_2;
13340  PyObject *__pyx_t_3 = NULL;
13341  PyObject *__pyx_t_4 = NULL;
13342  PyObject *__pyx_t_5 = NULL;
13343  char *__pyx_t_6;
13344  int __pyx_lineno = 0;
13345  const char *__pyx_filename = NULL;
13346  int __pyx_clineno = 0;
13347  __Pyx_RefNannySetupContext("__getitem__", 0);
13348  __Pyx_TraceCall("__getitem__", __pyx_f[1], 405, 0, __PYX_ERR(1, 405, __pyx_L1_error));
13349 
13350  /* "View.MemoryView":406
13351  *
13352  * def __getitem__(memoryview self, object index):
13353  * if index is Ellipsis: # <<<<<<<<<<<<<<
13354  * return self
13355  *
13356  */
13357  __Pyx_TraceLine(406,0,__PYX_ERR(1, 406, __pyx_L1_error))
13358  __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
13359  __pyx_t_2 = (__pyx_t_1 != 0);
13360  if (__pyx_t_2) {
13361 
13362  /* "View.MemoryView":407
13363  * def __getitem__(memoryview self, object index):
13364  * if index is Ellipsis:
13365  * return self # <<<<<<<<<<<<<<
13366  *
13367  * have_slices, indices = _unellipsify(index, self.view.ndim)
13368  */
13369  __Pyx_TraceLine(407,0,__PYX_ERR(1, 407, __pyx_L1_error))
13370  __Pyx_XDECREF(__pyx_r);
13371  __Pyx_INCREF(((PyObject *)__pyx_v_self));
13372  __pyx_r = ((PyObject *)__pyx_v_self);
13373  goto __pyx_L0;
13374 
13375  /* "View.MemoryView":406
13376  *
13377  * def __getitem__(memoryview self, object index):
13378  * if index is Ellipsis: # <<<<<<<<<<<<<<
13379  * return self
13380  *
13381  */
13382  }
13383 
13384  /* "View.MemoryView":409
13385  * return self
13386  *
13387  * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
13388  *
13389  * cdef char *itemp
13390  */
13391  __Pyx_TraceLine(409,0,__PYX_ERR(1, 409, __pyx_L1_error))
13392  __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 409, __pyx_L1_error)
13393  __Pyx_GOTREF(__pyx_t_3);
13394  if (likely(__pyx_t_3 != Py_None)) {
13395  PyObject* sequence = __pyx_t_3;
13396  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13397  if (unlikely(size != 2)) {
13398  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13399  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13400  __PYX_ERR(1, 409, __pyx_L1_error)
13401  }
13402  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13403  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
13404  __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
13405  __Pyx_INCREF(__pyx_t_4);
13406  __Pyx_INCREF(__pyx_t_5);
13407  #else
13408  __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 409, __pyx_L1_error)
13409  __Pyx_GOTREF(__pyx_t_4);
13410  __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 409, __pyx_L1_error)
13411  __Pyx_GOTREF(__pyx_t_5);
13412  #endif
13413  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13414  } else {
13415  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 409, __pyx_L1_error)
13416  }
13417  __pyx_v_have_slices = __pyx_t_4;
13418  __pyx_t_4 = 0;
13419  __pyx_v_indices = __pyx_t_5;
13420  __pyx_t_5 = 0;
13421 
13422  /* "View.MemoryView":412
13423  *
13424  * cdef char *itemp
13425  * if have_slices: # <<<<<<<<<<<<<<
13426  * return memview_slice(self, indices)
13427  * else:
13428  */
13429  __Pyx_TraceLine(412,0,__PYX_ERR(1, 412, __pyx_L1_error))
13430  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 412, __pyx_L1_error)
13431  if (__pyx_t_2) {
13432 
13433  /* "View.MemoryView":413
13434  * cdef char *itemp
13435  * if have_slices:
13436  * return memview_slice(self, indices) # <<<<<<<<<<<<<<
13437  * else:
13438  * itemp = self.get_item_pointer(indices)
13439  */
13440  __Pyx_TraceLine(413,0,__PYX_ERR(1, 413, __pyx_L1_error))
13441  __Pyx_XDECREF(__pyx_r);
13442  __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 413, __pyx_L1_error)
13443  __Pyx_GOTREF(__pyx_t_3);
13444  __pyx_r = __pyx_t_3;
13445  __pyx_t_3 = 0;
13446  goto __pyx_L0;
13447 
13448  /* "View.MemoryView":412
13449  *
13450  * cdef char *itemp
13451  * if have_slices: # <<<<<<<<<<<<<<
13452  * return memview_slice(self, indices)
13453  * else:
13454  */
13455  }
13456 
13457  /* "View.MemoryView":415
13458  * return memview_slice(self, indices)
13459  * else:
13460  * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
13461  * return self.convert_item_to_object(itemp)
13462  *
13463  */
13464  __Pyx_TraceLine(415,0,__PYX_ERR(1, 415, __pyx_L1_error))
13465  /*else*/ {
13466  __pyx_t_6 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices); if (unlikely(__pyx_t_6 == ((char *)NULL))) __PYX_ERR(1, 415, __pyx_L1_error)
13467  __pyx_v_itemp = __pyx_t_6;
13468 
13469  /* "View.MemoryView":416
13470  * else:
13471  * itemp = self.get_item_pointer(indices)
13472  * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
13473  *
13474  * def __setitem__(memoryview self, object index, object value):
13475  */
13476  __Pyx_TraceLine(416,0,__PYX_ERR(1, 416, __pyx_L1_error))
13477  __Pyx_XDECREF(__pyx_r);
13478  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 416, __pyx_L1_error)
13479  __Pyx_GOTREF(__pyx_t_3);
13480  __pyx_r = __pyx_t_3;
13481  __pyx_t_3 = 0;
13482  goto __pyx_L0;
13483  }
13484 
13485  /* "View.MemoryView":405
13486  *
13487  *
13488  * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
13489  * if index is Ellipsis:
13490  * return self
13491  */
13492 
13493  /* function exit code */
13494  __pyx_L1_error:;
13495  __Pyx_XDECREF(__pyx_t_3);
13496  __Pyx_XDECREF(__pyx_t_4);
13497  __Pyx_XDECREF(__pyx_t_5);
13498  __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13499  __pyx_r = NULL;
13500  __pyx_L0:;
13501  __Pyx_XDECREF(__pyx_v_have_slices);
13502  __Pyx_XDECREF(__pyx_v_indices);
13503  __Pyx_XGIVEREF(__pyx_r);
13504  __Pyx_TraceReturn(__pyx_r, 0);
13505  __Pyx_RefNannyFinishContext();
13506  return __pyx_r;
13507 }
13508 
13509 /* "View.MemoryView":418
13510  * return self.convert_item_to_object(itemp)
13511  *
13512  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
13513  * if self.view.readonly:
13514  * raise TypeError("Cannot assign to read-only memoryview")
13515  */
13516 
13517 /* Python wrapper */
13518 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
13519 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
13520  int __pyx_r;
13521  __Pyx_RefNannyDeclarations
13522  __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
13523  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
13524 
13525  /* function exit code */
13526  __Pyx_RefNannyFinishContext();
13527  return __pyx_r;
13528 }
13529 
13530 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
13531  PyObject *__pyx_v_have_slices = NULL;
13532  PyObject *__pyx_v_obj = NULL;
13533  int __pyx_r;
13534  __Pyx_TraceDeclarations
13535  __Pyx_RefNannyDeclarations
13536  int __pyx_t_1;
13537  PyObject *__pyx_t_2 = NULL;
13538  PyObject *__pyx_t_3 = NULL;
13539  PyObject *__pyx_t_4 = NULL;
13540  int __pyx_lineno = 0;
13541  const char *__pyx_filename = NULL;
13542  int __pyx_clineno = 0;
13543  __Pyx_RefNannySetupContext("__setitem__", 0);
13544  __Pyx_TraceCall("__setitem__", __pyx_f[1], 418, 0, __PYX_ERR(1, 418, __pyx_L1_error));
13545  __Pyx_INCREF(__pyx_v_index);
13546 
13547  /* "View.MemoryView":419
13548  *
13549  * def __setitem__(memoryview self, object index, object value):
13550  * if self.view.readonly: # <<<<<<<<<<<<<<
13551  * raise TypeError("Cannot assign to read-only memoryview")
13552  *
13553  */
13554  __Pyx_TraceLine(419,0,__PYX_ERR(1, 419, __pyx_L1_error))
13555  __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
13556  if (unlikely(__pyx_t_1)) {
13557 
13558  /* "View.MemoryView":420
13559  * def __setitem__(memoryview self, object index, object value):
13560  * if self.view.readonly:
13561  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
13562  *
13563  * have_slices, index = _unellipsify(index, self.view.ndim)
13564  */
13565  __Pyx_TraceLine(420,0,__PYX_ERR(1, 420, __pyx_L1_error))
13566  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
13567  __Pyx_GOTREF(__pyx_t_2);
13568  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13569  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13570  __PYX_ERR(1, 420, __pyx_L1_error)
13571 
13572  /* "View.MemoryView":419
13573  *
13574  * def __setitem__(memoryview self, object index, object value):
13575  * if self.view.readonly: # <<<<<<<<<<<<<<
13576  * raise TypeError("Cannot assign to read-only memoryview")
13577  *
13578  */
13579  }
13580 
13581  /* "View.MemoryView":422
13582  * raise TypeError("Cannot assign to read-only memoryview")
13583  *
13584  * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
13585  *
13586  * if have_slices:
13587  */
13588  __Pyx_TraceLine(422,0,__PYX_ERR(1, 422, __pyx_L1_error))
13589  __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 422, __pyx_L1_error)
13590  __Pyx_GOTREF(__pyx_t_2);
13591  if (likely(__pyx_t_2 != Py_None)) {
13592  PyObject* sequence = __pyx_t_2;
13593  Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
13594  if (unlikely(size != 2)) {
13595  if (size > 2) __Pyx_RaiseTooManyValuesError(2);
13596  else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
13597  __PYX_ERR(1, 422, __pyx_L1_error)
13598  }
13599  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13600  __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
13601  __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
13602  __Pyx_INCREF(__pyx_t_3);
13603  __Pyx_INCREF(__pyx_t_4);
13604  #else
13605  __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 422, __pyx_L1_error)
13606  __Pyx_GOTREF(__pyx_t_3);
13607  __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 422, __pyx_L1_error)
13608  __Pyx_GOTREF(__pyx_t_4);
13609  #endif
13610  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13611  } else {
13612  __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 422, __pyx_L1_error)
13613  }
13614  __pyx_v_have_slices = __pyx_t_3;
13615  __pyx_t_3 = 0;
13616  __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
13617  __pyx_t_4 = 0;
13618 
13619  /* "View.MemoryView":424
13620  * have_slices, index = _unellipsify(index, self.view.ndim)
13621  *
13622  * if have_slices: # <<<<<<<<<<<<<<
13623  * obj = self.is_slice(value)
13624  * if obj:
13625  */
13626  __Pyx_TraceLine(424,0,__PYX_ERR(1, 424, __pyx_L1_error))
13627  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
13628  if (__pyx_t_1) {
13629 
13630  /* "View.MemoryView":425
13631  *
13632  * if have_slices:
13633  * obj = self.is_slice(value) # <<<<<<<<<<<<<<
13634  * if obj:
13635  * self.setitem_slice_assignment(self[index], obj)
13636  */
13637  __Pyx_TraceLine(425,0,__PYX_ERR(1, 425, __pyx_L1_error))
13638  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
13639  __Pyx_GOTREF(__pyx_t_2);
13640  __pyx_v_obj = __pyx_t_2;
13641  __pyx_t_2 = 0;
13642 
13643  /* "View.MemoryView":426
13644  * if have_slices:
13645  * obj = self.is_slice(value)
13646  * if obj: # <<<<<<<<<<<<<<
13647  * self.setitem_slice_assignment(self[index], obj)
13648  * else:
13649  */
13650  __Pyx_TraceLine(426,0,__PYX_ERR(1, 426, __pyx_L1_error))
13651  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 426, __pyx_L1_error)
13652  if (__pyx_t_1) {
13653 
13654  /* "View.MemoryView":427
13655  * obj = self.is_slice(value)
13656  * if obj:
13657  * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
13658  * else:
13659  * self.setitem_slice_assign_scalar(self[index], value)
13660  */
13661  __Pyx_TraceLine(427,0,__PYX_ERR(1, 427, __pyx_L1_error))
13662  __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
13663  __Pyx_GOTREF(__pyx_t_2);
13664  __pyx_t_4 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
13665  __Pyx_GOTREF(__pyx_t_4);
13666  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13667  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13668 
13669  /* "View.MemoryView":426
13670  * if have_slices:
13671  * obj = self.is_slice(value)
13672  * if obj: # <<<<<<<<<<<<<<
13673  * self.setitem_slice_assignment(self[index], obj)
13674  * else:
13675  */
13676  goto __pyx_L5;
13677  }
13678 
13679  /* "View.MemoryView":429
13680  * self.setitem_slice_assignment(self[index], obj)
13681  * else:
13682  * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
13683  * else:
13684  * self.setitem_indexed(index, value)
13685  */
13686  __Pyx_TraceLine(429,0,__PYX_ERR(1, 429, __pyx_L1_error))
13687  /*else*/ {
13688  __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 429, __pyx_L1_error)
13689  __Pyx_GOTREF(__pyx_t_4);
13690  if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 429, __pyx_L1_error)
13691  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
13692  __Pyx_GOTREF(__pyx_t_2);
13693  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13694  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13695  }
13696  __pyx_L5:;
13697 
13698  /* "View.MemoryView":424
13699  * have_slices, index = _unellipsify(index, self.view.ndim)
13700  *
13701  * if have_slices: # <<<<<<<<<<<<<<
13702  * obj = self.is_slice(value)
13703  * if obj:
13704  */
13705  goto __pyx_L4;
13706  }
13707 
13708  /* "View.MemoryView":431
13709  * self.setitem_slice_assign_scalar(self[index], value)
13710  * else:
13711  * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
13712  *
13713  * cdef is_slice(self, obj):
13714  */
13715  __Pyx_TraceLine(431,0,__PYX_ERR(1, 431, __pyx_L1_error))
13716  /*else*/ {
13717  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 431, __pyx_L1_error)
13718  __Pyx_GOTREF(__pyx_t_2);
13719  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13720  }
13721  __pyx_L4:;
13722 
13723  /* "View.MemoryView":418
13724  * return self.convert_item_to_object(itemp)
13725  *
13726  * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
13727  * if self.view.readonly:
13728  * raise TypeError("Cannot assign to read-only memoryview")
13729  */
13730 
13731  /* function exit code */
13732  __pyx_r = 0;
13733  goto __pyx_L0;
13734  __pyx_L1_error:;
13735  __Pyx_XDECREF(__pyx_t_2);
13736  __Pyx_XDECREF(__pyx_t_3);
13737  __Pyx_XDECREF(__pyx_t_4);
13738  __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13739  __pyx_r = -1;
13740  __pyx_L0:;
13741  __Pyx_XDECREF(__pyx_v_have_slices);
13742  __Pyx_XDECREF(__pyx_v_obj);
13743  __Pyx_XDECREF(__pyx_v_index);
13744  __Pyx_TraceReturn(Py_None, 0);
13745  __Pyx_RefNannyFinishContext();
13746  return __pyx_r;
13747 }
13748 
13749 /* "View.MemoryView":433
13750  * self.setitem_indexed(index, value)
13751  *
13752  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
13753  * if not isinstance(obj, memoryview):
13754  * try:
13755  */
13756 
13757 static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
13758  PyObject *__pyx_r = NULL;
13759  __Pyx_TraceDeclarations
13760  __Pyx_RefNannyDeclarations
13761  int __pyx_t_1;
13762  int __pyx_t_2;
13763  PyObject *__pyx_t_3 = NULL;
13764  PyObject *__pyx_t_4 = NULL;
13765  PyObject *__pyx_t_5 = NULL;
13766  PyObject *__pyx_t_6 = NULL;
13767  PyObject *__pyx_t_7 = NULL;
13768  PyObject *__pyx_t_8 = NULL;
13769  int __pyx_t_9;
13770  int __pyx_lineno = 0;
13771  const char *__pyx_filename = NULL;
13772  int __pyx_clineno = 0;
13773  __Pyx_RefNannySetupContext("is_slice", 0);
13774  __Pyx_TraceCall("is_slice", __pyx_f[1], 433, 0, __PYX_ERR(1, 433, __pyx_L1_error));
13775  __Pyx_INCREF(__pyx_v_obj);
13776 
13777  /* "View.MemoryView":434
13778  *
13779  * cdef is_slice(self, obj):
13780  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
13781  * try:
13782  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13783  */
13784  __Pyx_TraceLine(434,0,__PYX_ERR(1, 434, __pyx_L1_error))
13785  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
13786  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13787  if (__pyx_t_2) {
13788 
13789  /* "View.MemoryView":435
13790  * cdef is_slice(self, obj):
13791  * if not isinstance(obj, memoryview):
13792  * try: # <<<<<<<<<<<<<<
13793  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13794  * self.dtype_is_object)
13795  */
13796  __Pyx_TraceLine(435,0,__PYX_ERR(1, 435, __pyx_L1_error))
13797  {
13798  __Pyx_PyThreadState_declare
13799  __Pyx_PyThreadState_assign
13800  __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
13801  __Pyx_XGOTREF(__pyx_t_3);
13802  __Pyx_XGOTREF(__pyx_t_4);
13803  __Pyx_XGOTREF(__pyx_t_5);
13804  /*try:*/ {
13805 
13806  /* "View.MemoryView":436
13807  * if not isinstance(obj, memoryview):
13808  * try:
13809  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
13810  * self.dtype_is_object)
13811  * except TypeError:
13812  */
13813  __Pyx_TraceLine(436,0,__PYX_ERR(1, 436, __pyx_L4_error))
13814  __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 436, __pyx_L4_error)
13815  __Pyx_GOTREF(__pyx_t_6);
13816 
13817  /* "View.MemoryView":437
13818  * try:
13819  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13820  * self.dtype_is_object) # <<<<<<<<<<<<<<
13821  * except TypeError:
13822  * return None
13823  */
13824  __Pyx_TraceLine(437,0,__PYX_ERR(1, 437, __pyx_L4_error))
13825  __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 437, __pyx_L4_error)
13826  __Pyx_GOTREF(__pyx_t_7);
13827 
13828  /* "View.MemoryView":436
13829  * if not isinstance(obj, memoryview):
13830  * try:
13831  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
13832  * self.dtype_is_object)
13833  * except TypeError:
13834  */
13835  __Pyx_TraceLine(436,0,__PYX_ERR(1, 436, __pyx_L4_error))
13836  __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 436, __pyx_L4_error)
13837  __Pyx_GOTREF(__pyx_t_8);
13838  __Pyx_INCREF(__pyx_v_obj);
13839  __Pyx_GIVEREF(__pyx_v_obj);
13840  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
13841  __Pyx_GIVEREF(__pyx_t_6);
13842  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
13843  __Pyx_GIVEREF(__pyx_t_7);
13844  PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
13845  __pyx_t_6 = 0;
13846  __pyx_t_7 = 0;
13847  __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 436, __pyx_L4_error)
13848  __Pyx_GOTREF(__pyx_t_7);
13849  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13850  __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
13851  __pyx_t_7 = 0;
13852 
13853  /* "View.MemoryView":435
13854  * cdef is_slice(self, obj):
13855  * if not isinstance(obj, memoryview):
13856  * try: # <<<<<<<<<<<<<<
13857  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13858  * self.dtype_is_object)
13859  */
13860  }
13861  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
13862  __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
13863  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
13864  goto __pyx_L9_try_end;
13865  __pyx_L4_error:;
13866  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
13867  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
13868  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
13869 
13870  /* "View.MemoryView":438
13871  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13872  * self.dtype_is_object)
13873  * except TypeError: # <<<<<<<<<<<<<<
13874  * return None
13875  *
13876  */
13877  __Pyx_TraceLine(438,0,__PYX_ERR(1, 438, __pyx_L6_except_error))
13878  __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
13879  if (__pyx_t_9) {
13880  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13881  if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 438, __pyx_L6_except_error)
13882  __Pyx_GOTREF(__pyx_t_7);
13883  __Pyx_GOTREF(__pyx_t_8);
13884  __Pyx_GOTREF(__pyx_t_6);
13885 
13886  /* "View.MemoryView":439
13887  * self.dtype_is_object)
13888  * except TypeError:
13889  * return None # <<<<<<<<<<<<<<
13890  *
13891  * return obj
13892  */
13893  __Pyx_TraceLine(439,0,__PYX_ERR(1, 439, __pyx_L6_except_error))
13894  __Pyx_XDECREF(__pyx_r);
13895  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13896  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13897  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13898  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
13899  goto __pyx_L7_except_return;
13900  }
13901  goto __pyx_L6_except_error;
13902  __pyx_L6_except_error:;
13903 
13904  /* "View.MemoryView":435
13905  * cdef is_slice(self, obj):
13906  * if not isinstance(obj, memoryview):
13907  * try: # <<<<<<<<<<<<<<
13908  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13909  * self.dtype_is_object)
13910  */
13911  __Pyx_XGIVEREF(__pyx_t_3);
13912  __Pyx_XGIVEREF(__pyx_t_4);
13913  __Pyx_XGIVEREF(__pyx_t_5);
13914  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
13915  goto __pyx_L1_error;
13916  __pyx_L7_except_return:;
13917  __Pyx_XGIVEREF(__pyx_t_3);
13918  __Pyx_XGIVEREF(__pyx_t_4);
13919  __Pyx_XGIVEREF(__pyx_t_5);
13920  __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
13921  goto __pyx_L0;
13922  __pyx_L9_try_end:;
13923  }
13924 
13925  /* "View.MemoryView":434
13926  *
13927  * cdef is_slice(self, obj):
13928  * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
13929  * try:
13930  * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
13931  */
13932  }
13933 
13934  /* "View.MemoryView":441
13935  * return None
13936  *
13937  * return obj # <<<<<<<<<<<<<<
13938  *
13939  * cdef setitem_slice_assignment(self, dst, src):
13940  */
13941  __Pyx_TraceLine(441,0,__PYX_ERR(1, 441, __pyx_L1_error))
13942  __Pyx_XDECREF(__pyx_r);
13943  __Pyx_INCREF(__pyx_v_obj);
13944  __pyx_r = __pyx_v_obj;
13945  goto __pyx_L0;
13946 
13947  /* "View.MemoryView":433
13948  * self.setitem_indexed(index, value)
13949  *
13950  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
13951  * if not isinstance(obj, memoryview):
13952  * try:
13953  */
13954 
13955  /* function exit code */
13956  __pyx_L1_error:;
13957  __Pyx_XDECREF(__pyx_t_6);
13958  __Pyx_XDECREF(__pyx_t_7);
13959  __Pyx_XDECREF(__pyx_t_8);
13960  __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
13961  __pyx_r = 0;
13962  __pyx_L0:;
13963  __Pyx_XDECREF(__pyx_v_obj);
13964  __Pyx_XGIVEREF(__pyx_r);
13965  __Pyx_TraceReturn(__pyx_r, 0);
13966  __Pyx_RefNannyFinishContext();
13967  return __pyx_r;
13968 }
13969 
13970 /* "View.MemoryView":443
13971  * return obj
13972  *
13973  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
13974  * cdef __Pyx_memviewslice dst_slice
13975  * cdef __Pyx_memviewslice src_slice
13976  */
13977 
13978 static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
13979  __Pyx_memviewslice __pyx_v_dst_slice;
13980  __Pyx_memviewslice __pyx_v_src_slice;
13981  PyObject *__pyx_r = NULL;
13982  __Pyx_TraceDeclarations
13983  __Pyx_RefNannyDeclarations
13984  __Pyx_memviewslice *__pyx_t_1;
13985  __Pyx_memviewslice *__pyx_t_2;
13986  PyObject *__pyx_t_3 = NULL;
13987  int __pyx_t_4;
13988  int __pyx_t_5;
13989  int __pyx_t_6;
13990  int __pyx_lineno = 0;
13991  const char *__pyx_filename = NULL;
13992  int __pyx_clineno = 0;
13993  __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
13994  __Pyx_TraceCall("setitem_slice_assignment", __pyx_f[1], 443, 0, __PYX_ERR(1, 443, __pyx_L1_error));
13995 
13996  /* "View.MemoryView":447
13997  * cdef __Pyx_memviewslice src_slice
13998  *
13999  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
14000  * get_slice_from_memview(dst, &dst_slice)[0],
14001  * src.ndim, dst.ndim, self.dtype_is_object)
14002  */
14003  __Pyx_TraceLine(447,0,__PYX_ERR(1, 447, __pyx_L1_error))
14004  if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 447, __pyx_L1_error)
14005  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 447, __pyx_L1_error)
14006 
14007  /* "View.MemoryView":448
14008  *
14009  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
14010  * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
14011  * src.ndim, dst.ndim, self.dtype_is_object)
14012  *
14013  */
14014  __Pyx_TraceLine(448,0,__PYX_ERR(1, 448, __pyx_L1_error))
14015  if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 448, __pyx_L1_error)
14016  __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice)); if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 448, __pyx_L1_error)
14017 
14018  /* "View.MemoryView":449
14019  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
14020  * get_slice_from_memview(dst, &dst_slice)[0],
14021  * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
14022  *
14023  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
14024  */
14025  __Pyx_TraceLine(449,0,__PYX_ERR(1, 449, __pyx_L1_error))
14026  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 449, __pyx_L1_error)
14027  __Pyx_GOTREF(__pyx_t_3);
14028  __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 449, __pyx_L1_error)
14029  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14030  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 449, __pyx_L1_error)
14031  __Pyx_GOTREF(__pyx_t_3);
14032  __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 449, __pyx_L1_error)
14033  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14034 
14035  /* "View.MemoryView":447
14036  * cdef __Pyx_memviewslice src_slice
14037  *
14038  * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
14039  * get_slice_from_memview(dst, &dst_slice)[0],
14040  * src.ndim, dst.ndim, self.dtype_is_object)
14041  */
14042  __Pyx_TraceLine(447,0,__PYX_ERR(1, 447, __pyx_L1_error))
14043  __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 447, __pyx_L1_error)
14044 
14045  /* "View.MemoryView":443
14046  * return obj
14047  *
14048  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
14049  * cdef __Pyx_memviewslice dst_slice
14050  * cdef __Pyx_memviewslice src_slice
14051  */
14052 
14053  /* function exit code */
14054  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14055  goto __pyx_L0;
14056  __pyx_L1_error:;
14057  __Pyx_XDECREF(__pyx_t_3);
14058  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
14059  __pyx_r = 0;
14060  __pyx_L0:;
14061  __Pyx_XGIVEREF(__pyx_r);
14062  __Pyx_TraceReturn(__pyx_r, 0);
14063  __Pyx_RefNannyFinishContext();
14064  return __pyx_r;
14065 }
14066 
14067 /* "View.MemoryView":451
14068  * src.ndim, dst.ndim, self.dtype_is_object)
14069  *
14070  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
14071  * cdef int array[128]
14072  * cdef void *tmp = NULL
14073  */
14074 
14075 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memoryview_obj *__pyx_v_self, struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
14076  int __pyx_v_array[0x80];
14077  void *__pyx_v_tmp;
14078  void *__pyx_v_item;
14079  __Pyx_memviewslice *__pyx_v_dst_slice;
14080  __Pyx_memviewslice __pyx_v_tmp_slice;
14081  PyObject *__pyx_r = NULL;
14082  __Pyx_TraceDeclarations
14083  __Pyx_RefNannyDeclarations
14084  __Pyx_memviewslice *__pyx_t_1;
14085  int __pyx_t_2;
14086  PyObject *__pyx_t_3 = NULL;
14087  int __pyx_t_4;
14088  int __pyx_t_5;
14089  char const *__pyx_t_6;
14090  PyObject *__pyx_t_7 = NULL;
14091  PyObject *__pyx_t_8 = NULL;
14092  PyObject *__pyx_t_9 = NULL;
14093  PyObject *__pyx_t_10 = NULL;
14094  PyObject *__pyx_t_11 = NULL;
14095  PyObject *__pyx_t_12 = NULL;
14096  int __pyx_lineno = 0;
14097  const char *__pyx_filename = NULL;
14098  int __pyx_clineno = 0;
14099  __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
14100  __Pyx_TraceCall("setitem_slice_assign_scalar", __pyx_f[1], 451, 0, __PYX_ERR(1, 451, __pyx_L1_error));
14101 
14102  /* "View.MemoryView":453
14103  * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
14104  * cdef int array[128]
14105  * cdef void *tmp = NULL # <<<<<<<<<<<<<<
14106  * cdef void *item
14107  *
14108  */
14109  __Pyx_TraceLine(453,0,__PYX_ERR(1, 453, __pyx_L1_error))
14110  __pyx_v_tmp = NULL;
14111 
14112  /* "View.MemoryView":458
14113  * cdef __Pyx_memviewslice *dst_slice
14114  * cdef __Pyx_memviewslice tmp_slice
14115  * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
14116  *
14117  * if <size_t>self.view.itemsize > sizeof(array):
14118  */
14119  __Pyx_TraceLine(458,0,__PYX_ERR(1, 458, __pyx_L1_error))
14120  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 458, __pyx_L1_error)
14121  __pyx_v_dst_slice = __pyx_t_1;
14122 
14123  /* "View.MemoryView":460
14124  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
14125  *
14126  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
14127  * tmp = PyMem_Malloc(self.view.itemsize)
14128  * if tmp == NULL:
14129  */
14130  __Pyx_TraceLine(460,0,__PYX_ERR(1, 460, __pyx_L1_error))
14131  __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
14132  if (__pyx_t_2) {
14133 
14134  /* "View.MemoryView":461
14135  *
14136  * if <size_t>self.view.itemsize > sizeof(array):
14137  * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
14138  * if tmp == NULL:
14139  * raise MemoryError
14140  */
14141  __Pyx_TraceLine(461,0,__PYX_ERR(1, 461, __pyx_L1_error))
14142  __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
14143 
14144  /* "View.MemoryView":462
14145  * if <size_t>self.view.itemsize > sizeof(array):
14146  * tmp = PyMem_Malloc(self.view.itemsize)
14147  * if tmp == NULL: # <<<<<<<<<<<<<<
14148  * raise MemoryError
14149  * item = tmp
14150  */
14151  __Pyx_TraceLine(462,0,__PYX_ERR(1, 462, __pyx_L1_error))
14152  __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
14153  if (unlikely(__pyx_t_2)) {
14154 
14155  /* "View.MemoryView":463
14156  * tmp = PyMem_Malloc(self.view.itemsize)
14157  * if tmp == NULL:
14158  * raise MemoryError # <<<<<<<<<<<<<<
14159  * item = tmp
14160  * else:
14161  */
14162  __Pyx_TraceLine(463,0,__PYX_ERR(1, 463, __pyx_L1_error))
14163  PyErr_NoMemory(); __PYX_ERR(1, 463, __pyx_L1_error)
14164 
14165  /* "View.MemoryView":462
14166  * if <size_t>self.view.itemsize > sizeof(array):
14167  * tmp = PyMem_Malloc(self.view.itemsize)
14168  * if tmp == NULL: # <<<<<<<<<<<<<<
14169  * raise MemoryError
14170  * item = tmp
14171  */
14172  }
14173 
14174  /* "View.MemoryView":464
14175  * if tmp == NULL:
14176  * raise MemoryError
14177  * item = tmp # <<<<<<<<<<<<<<
14178  * else:
14179  * item = <void *> array
14180  */
14181  __Pyx_TraceLine(464,0,__PYX_ERR(1, 464, __pyx_L1_error))
14182  __pyx_v_item = __pyx_v_tmp;
14183 
14184  /* "View.MemoryView":460
14185  * dst_slice = get_slice_from_memview(dst, &tmp_slice)
14186  *
14187  * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
14188  * tmp = PyMem_Malloc(self.view.itemsize)
14189  * if tmp == NULL:
14190  */
14191  goto __pyx_L3;
14192  }
14193 
14194  /* "View.MemoryView":466
14195  * item = tmp
14196  * else:
14197  * item = <void *> array # <<<<<<<<<<<<<<
14198  *
14199  * try:
14200  */
14201  __Pyx_TraceLine(466,0,__PYX_ERR(1, 466, __pyx_L1_error))
14202  /*else*/ {
14203  __pyx_v_item = ((void *)__pyx_v_array);
14204  }
14205  __pyx_L3:;
14206 
14207  /* "View.MemoryView":468
14208  * item = <void *> array
14209  *
14210  * try: # <<<<<<<<<<<<<<
14211  * if self.dtype_is_object:
14212  * (<PyObject **> item)[0] = <PyObject *> value
14213  */
14214  __Pyx_TraceLine(468,0,__PYX_ERR(1, 468, __pyx_L1_error))
14215  /*try:*/ {
14216 
14217  /* "View.MemoryView":469
14218  *
14219  * try:
14220  * if self.dtype_is_object: # <<<<<<<<<<<<<<
14221  * (<PyObject **> item)[0] = <PyObject *> value
14222  * else:
14223  */
14224  __Pyx_TraceLine(469,0,__PYX_ERR(1, 469, __pyx_L6_error))
14225  __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
14226  if (__pyx_t_2) {
14227 
14228  /* "View.MemoryView":470
14229  * try:
14230  * if self.dtype_is_object:
14231  * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
14232  * else:
14233  * self.assign_item_from_object(<char *> item, value)
14234  */
14235  __Pyx_TraceLine(470,0,__PYX_ERR(1, 470, __pyx_L6_error))
14236  (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
14237 
14238  /* "View.MemoryView":469
14239  *
14240  * try:
14241  * if self.dtype_is_object: # <<<<<<<<<<<<<<
14242  * (<PyObject **> item)[0] = <PyObject *> value
14243  * else:
14244  */
14245  goto __pyx_L8;
14246  }
14247 
14248  /* "View.MemoryView":472
14249  * (<PyObject **> item)[0] = <PyObject *> value
14250  * else:
14251  * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
14252  *
14253  *
14254  */
14255  __Pyx_TraceLine(472,0,__PYX_ERR(1, 472, __pyx_L6_error))
14256  /*else*/ {
14257  __pyx_t_3 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((char *)__pyx_v_item), __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 472, __pyx_L6_error)
14258  __Pyx_GOTREF(__pyx_t_3);
14259  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14260  }
14261  __pyx_L8:;
14262 
14263  /* "View.MemoryView":476
14264  *
14265  *
14266  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
14267  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
14268  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
14269  */
14270  __Pyx_TraceLine(476,0,__PYX_ERR(1, 476, __pyx_L6_error))
14271  __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
14272  if (__pyx_t_2) {
14273 
14274  /* "View.MemoryView":477
14275  *
14276  * if self.view.suboffsets != NULL:
14277  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
14278  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
14279  * item, self.dtype_is_object)
14280  */
14281  __Pyx_TraceLine(477,0,__PYX_ERR(1, 477, __pyx_L6_error))
14282  __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 477, __pyx_L6_error)
14283  __Pyx_GOTREF(__pyx_t_3);
14284  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14285 
14286  /* "View.MemoryView":476
14287  *
14288  *
14289  * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
14290  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
14291  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
14292  */
14293  }
14294 
14295  /* "View.MemoryView":478
14296  * if self.view.suboffsets != NULL:
14297  * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
14298  * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
14299  * item, self.dtype_is_object)
14300  * finally:
14301  */
14302  __Pyx_TraceLine(478,0,__PYX_ERR(1, 478, __pyx_L6_error))
14303  __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
14304  }
14305 
14306  /* "View.MemoryView":481
14307  * item, self.dtype_is_object)
14308  * finally:
14309  * PyMem_Free(tmp) # <<<<<<<<<<<<<<
14310  *
14311  * cdef setitem_indexed(self, index, value):
14312  */
14313  __Pyx_TraceLine(481,0,__PYX_ERR(1, 481, __pyx_L6_error))
14314  /*finally:*/ {
14315  /*normal exit:*/{
14316  PyMem_Free(__pyx_v_tmp);
14317  goto __pyx_L7;
14318  }
14319  __pyx_L6_error:;
14320  /*exception exit:*/{
14321  __Pyx_PyThreadState_declare
14322  __Pyx_PyThreadState_assign
14323  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14324  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
14325  if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
14326  if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
14327  __Pyx_XGOTREF(__pyx_t_7);
14328  __Pyx_XGOTREF(__pyx_t_8);
14329  __Pyx_XGOTREF(__pyx_t_9);
14330  __Pyx_XGOTREF(__pyx_t_10);
14331  __Pyx_XGOTREF(__pyx_t_11);
14332  __Pyx_XGOTREF(__pyx_t_12);
14333  __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
14334  {
14335  PyMem_Free(__pyx_v_tmp);
14336  }
14337  if (PY_MAJOR_VERSION >= 3) {
14338  __Pyx_XGIVEREF(__pyx_t_10);
14339  __Pyx_XGIVEREF(__pyx_t_11);
14340  __Pyx_XGIVEREF(__pyx_t_12);
14341  __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
14342  }
14343  __Pyx_XGIVEREF(__pyx_t_7);
14344  __Pyx_XGIVEREF(__pyx_t_8);
14345  __Pyx_XGIVEREF(__pyx_t_9);
14346  __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
14347  __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
14348  __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
14349  goto __pyx_L1_error;
14350  }
14351  __pyx_L7:;
14352  }
14353 
14354  /* "View.MemoryView":451
14355  * src.ndim, dst.ndim, self.dtype_is_object)
14356  *
14357  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
14358  * cdef int array[128]
14359  * cdef void *tmp = NULL
14360  */
14361 
14362  /* function exit code */
14363  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14364  goto __pyx_L0;
14365  __pyx_L1_error:;
14366  __Pyx_XDECREF(__pyx_t_3);
14367  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
14368  __pyx_r = 0;
14369  __pyx_L0:;
14370  __Pyx_XGIVEREF(__pyx_r);
14371  __Pyx_TraceReturn(__pyx_r, 0);
14372  __Pyx_RefNannyFinishContext();
14373  return __pyx_r;
14374 }
14375 
14376 /* "View.MemoryView":483
14377  * PyMem_Free(tmp)
14378  *
14379  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
14380  * cdef char *itemp = self.get_item_pointer(index)
14381  * self.assign_item_from_object(itemp, value)
14382  */
14383 
14384 static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
14385  char *__pyx_v_itemp;
14386  PyObject *__pyx_r = NULL;
14387  __Pyx_TraceDeclarations
14388  __Pyx_RefNannyDeclarations
14389  char *__pyx_t_1;
14390  PyObject *__pyx_t_2 = NULL;
14391  int __pyx_lineno = 0;
14392  const char *__pyx_filename = NULL;
14393  int __pyx_clineno = 0;
14394  __Pyx_RefNannySetupContext("setitem_indexed", 0);
14395  __Pyx_TraceCall("setitem_indexed", __pyx_f[1], 483, 0, __PYX_ERR(1, 483, __pyx_L1_error));
14396 
14397  /* "View.MemoryView":484
14398  *
14399  * cdef setitem_indexed(self, index, value):
14400  * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
14401  * self.assign_item_from_object(itemp, value)
14402  *
14403  */
14404  __Pyx_TraceLine(484,0,__PYX_ERR(1, 484, __pyx_L1_error))
14405  __pyx_t_1 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index); if (unlikely(__pyx_t_1 == ((char *)NULL))) __PYX_ERR(1, 484, __pyx_L1_error)
14406  __pyx_v_itemp = __pyx_t_1;
14407 
14408  /* "View.MemoryView":485
14409  * cdef setitem_indexed(self, index, value):
14410  * cdef char *itemp = self.get_item_pointer(index)
14411  * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
14412  *
14413  * cdef convert_item_to_object(self, char *itemp):
14414  */
14415  __Pyx_TraceLine(485,0,__PYX_ERR(1, 485, __pyx_L1_error))
14416  __pyx_t_2 = ((struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 485, __pyx_L1_error)
14417  __Pyx_GOTREF(__pyx_t_2);
14418  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14419 
14420  /* "View.MemoryView":483
14421  * PyMem_Free(tmp)
14422  *
14423  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
14424  * cdef char *itemp = self.get_item_pointer(index)
14425  * self.assign_item_from_object(itemp, value)
14426  */
14427 
14428  /* function exit code */
14429  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14430  goto __pyx_L0;
14431  __pyx_L1_error:;
14432  __Pyx_XDECREF(__pyx_t_2);
14433  __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
14434  __pyx_r = 0;
14435  __pyx_L0:;
14436  __Pyx_XGIVEREF(__pyx_r);
14437  __Pyx_TraceReturn(__pyx_r, 0);
14438  __Pyx_RefNannyFinishContext();
14439  return __pyx_r;
14440 }
14441 
14442 /* "View.MemoryView":487
14443  * self.assign_item_from_object(itemp, value)
14444  *
14445  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
14446  * """Only used if instantiated manually by the user, or if Cython doesn't
14447  * know how to convert the type"""
14448  */
14449 
14450 static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
14451  PyObject *__pyx_v_struct = NULL;
14452  PyObject *__pyx_v_bytesitem = 0;
14453  PyObject *__pyx_v_result = NULL;
14454  PyObject *__pyx_r = NULL;
14455  __Pyx_TraceDeclarations
14456  __Pyx_RefNannyDeclarations
14457  PyObject *__pyx_t_1 = NULL;
14458  PyObject *__pyx_t_2 = NULL;
14459  PyObject *__pyx_t_3 = NULL;
14460  PyObject *__pyx_t_4 = NULL;
14461  PyObject *__pyx_t_5 = NULL;
14462  PyObject *__pyx_t_6 = NULL;
14463  PyObject *__pyx_t_7 = NULL;
14464  int __pyx_t_8;
14465  PyObject *__pyx_t_9 = NULL;
14466  size_t __pyx_t_10;
14467  int __pyx_t_11;
14468  int __pyx_lineno = 0;
14469  const char *__pyx_filename = NULL;
14470  int __pyx_clineno = 0;
14471  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
14472  __Pyx_TraceCall("convert_item_to_object", __pyx_f[1], 487, 0, __PYX_ERR(1, 487, __pyx_L1_error));
14473 
14474  /* "View.MemoryView":490
14475  * """Only used if instantiated manually by the user, or if Cython doesn't
14476  * know how to convert the type"""
14477  * import struct # <<<<<<<<<<<<<<
14478  * cdef bytes bytesitem
14479  *
14480  */
14481  __Pyx_TraceLine(490,0,__PYX_ERR(1, 490, __pyx_L1_error))
14482  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 490, __pyx_L1_error)
14483  __Pyx_GOTREF(__pyx_t_1);
14484  __pyx_v_struct = __pyx_t_1;
14485  __pyx_t_1 = 0;
14486 
14487  /* "View.MemoryView":493
14488  * cdef bytes bytesitem
14489  *
14490  * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
14491  * try:
14492  * result = struct.unpack(self.view.format, bytesitem)
14493  */
14494  __Pyx_TraceLine(493,0,__PYX_ERR(1, 493, __pyx_L1_error))
14495  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L1_error)
14496  __Pyx_GOTREF(__pyx_t_1);
14497  __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
14498  __pyx_t_1 = 0;
14499 
14500  /* "View.MemoryView":494
14501  *
14502  * bytesitem = itemp[:self.view.itemsize]
14503  * try: # <<<<<<<<<<<<<<
14504  * result = struct.unpack(self.view.format, bytesitem)
14505  * except struct.error:
14506  */
14507  __Pyx_TraceLine(494,0,__PYX_ERR(1, 494, __pyx_L1_error))
14508  {
14509  __Pyx_PyThreadState_declare
14510  __Pyx_PyThreadState_assign
14511  __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
14512  __Pyx_XGOTREF(__pyx_t_2);
14513  __Pyx_XGOTREF(__pyx_t_3);
14514  __Pyx_XGOTREF(__pyx_t_4);
14515  /*try:*/ {
14516 
14517  /* "View.MemoryView":495
14518  * bytesitem = itemp[:self.view.itemsize]
14519  * try:
14520  * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
14521  * except struct.error:
14522  * raise ValueError("Unable to convert item to object")
14523  */
14524  __Pyx_TraceLine(495,0,__PYX_ERR(1, 495, __pyx_L3_error))
14525  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 495, __pyx_L3_error)
14526  __Pyx_GOTREF(__pyx_t_5);
14527  __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L3_error)
14528  __Pyx_GOTREF(__pyx_t_6);
14529  __pyx_t_7 = NULL;
14530  __pyx_t_8 = 0;
14531  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
14532  __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
14533  if (likely(__pyx_t_7)) {
14534  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
14535  __Pyx_INCREF(__pyx_t_7);
14536  __Pyx_INCREF(function);
14537  __Pyx_DECREF_SET(__pyx_t_5, function);
14538  __pyx_t_8 = 1;
14539  }
14540  }
14541  #if CYTHON_FAST_PYCALL
14542  if (PyFunction_Check(__pyx_t_5)) {
14543  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
14544  __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14545  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14546  __Pyx_GOTREF(__pyx_t_1);
14547  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14548  } else
14549  #endif
14550  #if CYTHON_FAST_PYCCALL
14551  if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
14552  PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
14553  __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14554  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14555  __Pyx_GOTREF(__pyx_t_1);
14556  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14557  } else
14558  #endif
14559  {
14560  __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 495, __pyx_L3_error)
14561  __Pyx_GOTREF(__pyx_t_9);
14562  if (__pyx_t_7) {
14563  __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
14564  }
14565  __Pyx_GIVEREF(__pyx_t_6);
14566  PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
14567  __Pyx_INCREF(__pyx_v_bytesitem);
14568  __Pyx_GIVEREF(__pyx_v_bytesitem);
14569  PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
14570  __pyx_t_6 = 0;
14571  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 495, __pyx_L3_error)
14572  __Pyx_GOTREF(__pyx_t_1);
14573  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14574  }
14575  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14576  __pyx_v_result = __pyx_t_1;
14577  __pyx_t_1 = 0;
14578 
14579  /* "View.MemoryView":494
14580  *
14581  * bytesitem = itemp[:self.view.itemsize]
14582  * try: # <<<<<<<<<<<<<<
14583  * result = struct.unpack(self.view.format, bytesitem)
14584  * except struct.error:
14585  */
14586  }
14587 
14588  /* "View.MemoryView":499
14589  * raise ValueError("Unable to convert item to object")
14590  * else:
14591  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
14592  * return result[0]
14593  * return result
14594  */
14595  __Pyx_TraceLine(499,0,__PYX_ERR(1, 499, __pyx_L5_except_error))
14596  /*else:*/ {
14597  __pyx_t_10 = strlen(__pyx_v_self->view.format);
14598  __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
14599  if (__pyx_t_11) {
14600 
14601  /* "View.MemoryView":500
14602  * else:
14603  * if len(self.view.format) == 1:
14604  * return result[0] # <<<<<<<<<<<<<<
14605  * return result
14606  *
14607  */
14608  __Pyx_TraceLine(500,0,__PYX_ERR(1, 500, __pyx_L5_except_error))
14609  __Pyx_XDECREF(__pyx_r);
14610  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 500, __pyx_L5_except_error)
14611  __Pyx_GOTREF(__pyx_t_1);
14612  __pyx_r = __pyx_t_1;
14613  __pyx_t_1 = 0;
14614  goto __pyx_L6_except_return;
14615 
14616  /* "View.MemoryView":499
14617  * raise ValueError("Unable to convert item to object")
14618  * else:
14619  * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
14620  * return result[0]
14621  * return result
14622  */
14623  }
14624 
14625  /* "View.MemoryView":501
14626  * if len(self.view.format) == 1:
14627  * return result[0]
14628  * return result # <<<<<<<<<<<<<<
14629  *
14630  * cdef assign_item_from_object(self, char *itemp, object value):
14631  */
14632  __Pyx_TraceLine(501,0,__PYX_ERR(1, 501, __pyx_L5_except_error))
14633  __Pyx_XDECREF(__pyx_r);
14634  __Pyx_INCREF(__pyx_v_result);
14635  __pyx_r = __pyx_v_result;
14636  goto __pyx_L6_except_return;
14637  }
14638  __pyx_L3_error:;
14639  __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
14640  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14641  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
14642  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
14643  __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
14644 
14645  /* "View.MemoryView":496
14646  * try:
14647  * result = struct.unpack(self.view.format, bytesitem)
14648  * except struct.error: # <<<<<<<<<<<<<<
14649  * raise ValueError("Unable to convert item to object")
14650  * else:
14651  */
14652  __Pyx_TraceLine(496,0,__PYX_ERR(1, 496, __pyx_L5_except_error))
14653  __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
14654  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 496, __pyx_L5_except_error)
14655  __Pyx_GOTREF(__pyx_t_6);
14656  __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
14657  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14658  __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
14659  __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
14660  if (__pyx_t_8) {
14661  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14662  if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 496, __pyx_L5_except_error)
14663  __Pyx_GOTREF(__pyx_t_9);
14664  __Pyx_GOTREF(__pyx_t_5);
14665  __Pyx_GOTREF(__pyx_t_1);
14666 
14667  /* "View.MemoryView":497
14668  * result = struct.unpack(self.view.format, bytesitem)
14669  * except struct.error:
14670  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
14671  * else:
14672  * if len(self.view.format) == 1:
14673  */
14674  __Pyx_TraceLine(497,0,__PYX_ERR(1, 497, __pyx_L5_except_error))
14675  __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 497, __pyx_L5_except_error)
14676  __Pyx_GOTREF(__pyx_t_6);
14677  __Pyx_Raise(__pyx_t_6, 0, 0, 0);
14678  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14679  __PYX_ERR(1, 497, __pyx_L5_except_error)
14680  }
14681  goto __pyx_L5_except_error;
14682  __pyx_L5_except_error:;
14683 
14684  /* "View.MemoryView":494
14685  *
14686  * bytesitem = itemp[:self.view.itemsize]
14687  * try: # <<<<<<<<<<<<<<
14688  * result = struct.unpack(self.view.format, bytesitem)
14689  * except struct.error:
14690  */
14691  __Pyx_XGIVEREF(__pyx_t_2);
14692  __Pyx_XGIVEREF(__pyx_t_3);
14693  __Pyx_XGIVEREF(__pyx_t_4);
14694  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
14695  goto __pyx_L1_error;
14696  __pyx_L6_except_return:;
14697  __Pyx_XGIVEREF(__pyx_t_2);
14698  __Pyx_XGIVEREF(__pyx_t_3);
14699  __Pyx_XGIVEREF(__pyx_t_4);
14700  __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
14701  goto __pyx_L0;
14702  }
14703 
14704  /* "View.MemoryView":487
14705  * self.assign_item_from_object(itemp, value)
14706  *
14707  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
14708  * """Only used if instantiated manually by the user, or if Cython doesn't
14709  * know how to convert the type"""
14710  */
14711 
14712  /* function exit code */
14713  __pyx_L1_error:;
14714  __Pyx_XDECREF(__pyx_t_1);
14715  __Pyx_XDECREF(__pyx_t_5);
14716  __Pyx_XDECREF(__pyx_t_6);
14717  __Pyx_XDECREF(__pyx_t_7);
14718  __Pyx_XDECREF(__pyx_t_9);
14719  __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14720  __pyx_r = 0;
14721  __pyx_L0:;
14722  __Pyx_XDECREF(__pyx_v_struct);
14723  __Pyx_XDECREF(__pyx_v_bytesitem);
14724  __Pyx_XDECREF(__pyx_v_result);
14725  __Pyx_XGIVEREF(__pyx_r);
14726  __Pyx_TraceReturn(__pyx_r, 0);
14727  __Pyx_RefNannyFinishContext();
14728  return __pyx_r;
14729 }
14730 
14731 /* "View.MemoryView":503
14732  * return result
14733  *
14734  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
14735  * """Only used if instantiated manually by the user, or if Cython doesn't
14736  * know how to convert the type"""
14737  */
14738 
14739 static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
14740  PyObject *__pyx_v_struct = NULL;
14741  char __pyx_v_c;
14742  PyObject *__pyx_v_bytesvalue = 0;
14743  Py_ssize_t __pyx_v_i;
14744  PyObject *__pyx_r = NULL;
14745  __Pyx_TraceDeclarations
14746  __Pyx_RefNannyDeclarations
14747  PyObject *__pyx_t_1 = NULL;
14748  int __pyx_t_2;
14749  int __pyx_t_3;
14750  PyObject *__pyx_t_4 = NULL;
14751  PyObject *__pyx_t_5 = NULL;
14752  PyObject *__pyx_t_6 = NULL;
14753  int __pyx_t_7;
14754  PyObject *__pyx_t_8 = NULL;
14755  Py_ssize_t __pyx_t_9;
14756  PyObject *__pyx_t_10 = NULL;
14757  char *__pyx_t_11;
14758  char *__pyx_t_12;
14759  char *__pyx_t_13;
14760  char *__pyx_t_14;
14761  int __pyx_lineno = 0;
14762  const char *__pyx_filename = NULL;
14763  int __pyx_clineno = 0;
14764  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
14765  __Pyx_TraceCall("assign_item_from_object", __pyx_f[1], 503, 0, __PYX_ERR(1, 503, __pyx_L1_error));
14766 
14767  /* "View.MemoryView":506
14768  * """Only used if instantiated manually by the user, or if Cython doesn't
14769  * know how to convert the type"""
14770  * import struct # <<<<<<<<<<<<<<
14771  * cdef char c
14772  * cdef bytes bytesvalue
14773  */
14774  __Pyx_TraceLine(506,0,__PYX_ERR(1, 506, __pyx_L1_error))
14775  __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 506, __pyx_L1_error)
14776  __Pyx_GOTREF(__pyx_t_1);
14777  __pyx_v_struct = __pyx_t_1;
14778  __pyx_t_1 = 0;
14779 
14780  /* "View.MemoryView":511
14781  * cdef Py_ssize_t i
14782  *
14783  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
14784  * bytesvalue = struct.pack(self.view.format, *value)
14785  * else:
14786  */
14787  __Pyx_TraceLine(511,0,__PYX_ERR(1, 511, __pyx_L1_error))
14788  __pyx_t_2 = PyTuple_Check(__pyx_v_value);
14789  __pyx_t_3 = (__pyx_t_2 != 0);
14790  if (__pyx_t_3) {
14791 
14792  /* "View.MemoryView":512
14793  *
14794  * if isinstance(value, tuple):
14795  * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
14796  * else:
14797  * bytesvalue = struct.pack(self.view.format, value)
14798  */
14799  __Pyx_TraceLine(512,0,__PYX_ERR(1, 512, __pyx_L1_error))
14800  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
14801  __Pyx_GOTREF(__pyx_t_1);
14802  __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14803  __Pyx_GOTREF(__pyx_t_4);
14804  __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 512, __pyx_L1_error)
14805  __Pyx_GOTREF(__pyx_t_5);
14806  __Pyx_GIVEREF(__pyx_t_4);
14807  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
14808  __pyx_t_4 = 0;
14809  __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14810  __Pyx_GOTREF(__pyx_t_4);
14811  __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
14812  __Pyx_GOTREF(__pyx_t_6);
14813  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
14814  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
14815  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
14816  __Pyx_GOTREF(__pyx_t_4);
14817  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14818  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14819  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
14820  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
14821  __pyx_t_4 = 0;
14822 
14823  /* "View.MemoryView":511
14824  * cdef Py_ssize_t i
14825  *
14826  * if isinstance(value, tuple): # <<<<<<<<<<<<<<
14827  * bytesvalue = struct.pack(self.view.format, *value)
14828  * else:
14829  */
14830  goto __pyx_L3;
14831  }
14832 
14833  /* "View.MemoryView":514
14834  * bytesvalue = struct.pack(self.view.format, *value)
14835  * else:
14836  * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
14837  *
14838  * for i, c in enumerate(bytesvalue):
14839  */
14840  __Pyx_TraceLine(514,0,__PYX_ERR(1, 514, __pyx_L1_error))
14841  /*else*/ {
14842  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 514, __pyx_L1_error)
14843  __Pyx_GOTREF(__pyx_t_6);
14844  __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 514, __pyx_L1_error)
14845  __Pyx_GOTREF(__pyx_t_1);
14846  __pyx_t_5 = NULL;
14847  __pyx_t_7 = 0;
14848  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
14849  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
14850  if (likely(__pyx_t_5)) {
14851  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
14852  __Pyx_INCREF(__pyx_t_5);
14853  __Pyx_INCREF(function);
14854  __Pyx_DECREF_SET(__pyx_t_6, function);
14855  __pyx_t_7 = 1;
14856  }
14857  }
14858  #if CYTHON_FAST_PYCALL
14859  if (PyFunction_Check(__pyx_t_6)) {
14860  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
14861  __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14862  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14863  __Pyx_GOTREF(__pyx_t_4);
14864  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14865  } else
14866  #endif
14867  #if CYTHON_FAST_PYCCALL
14868  if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
14869  PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
14870  __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14871  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
14872  __Pyx_GOTREF(__pyx_t_4);
14873  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14874  } else
14875  #endif
14876  {
14877  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 514, __pyx_L1_error)
14878  __Pyx_GOTREF(__pyx_t_8);
14879  if (__pyx_t_5) {
14880  __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
14881  }
14882  __Pyx_GIVEREF(__pyx_t_1);
14883  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
14884  __Pyx_INCREF(__pyx_v_value);
14885  __Pyx_GIVEREF(__pyx_v_value);
14886  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
14887  __pyx_t_1 = 0;
14888  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 514, __pyx_L1_error)
14889  __Pyx_GOTREF(__pyx_t_4);
14890  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
14891  }
14892  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
14893  if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 514, __pyx_L1_error)
14894  __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
14895  __pyx_t_4 = 0;
14896  }
14897  __pyx_L3:;
14898 
14899  /* "View.MemoryView":516
14900  * bytesvalue = struct.pack(self.view.format, value)
14901  *
14902  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
14903  * itemp[i] = c
14904  *
14905  */
14906  __Pyx_TraceLine(516,0,__PYX_ERR(1, 516, __pyx_L1_error))
14907  __pyx_t_9 = 0;
14908  if (unlikely(__pyx_v_bytesvalue == Py_None)) {
14909  PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
14910  __PYX_ERR(1, 516, __pyx_L1_error)
14911  }
14912  __Pyx_INCREF(__pyx_v_bytesvalue);
14913  __pyx_t_10 = __pyx_v_bytesvalue;
14914  __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
14915  __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
14916  for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
14917  __pyx_t_11 = __pyx_t_14;
14918  __pyx_v_c = (__pyx_t_11[0]);
14919 
14920  /* "View.MemoryView":517
14921  *
14922  * for i, c in enumerate(bytesvalue):
14923  * itemp[i] = c # <<<<<<<<<<<<<<
14924  *
14925  * @cname('getbuffer')
14926  */
14927  __Pyx_TraceLine(517,0,__PYX_ERR(1, 517, __pyx_L1_error))
14928  __pyx_v_i = __pyx_t_9;
14929 
14930  /* "View.MemoryView":516
14931  * bytesvalue = struct.pack(self.view.format, value)
14932  *
14933  * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
14934  * itemp[i] = c
14935  *
14936  */
14937  __Pyx_TraceLine(516,0,__PYX_ERR(1, 516, __pyx_L1_error))
14938  __pyx_t_9 = (__pyx_t_9 + 1);
14939 
14940  /* "View.MemoryView":517
14941  *
14942  * for i, c in enumerate(bytesvalue):
14943  * itemp[i] = c # <<<<<<<<<<<<<<
14944  *
14945  * @cname('getbuffer')
14946  */
14947  __Pyx_TraceLine(517,0,__PYX_ERR(1, 517, __pyx_L1_error))
14948  (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
14949  }
14950  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
14951 
14952  /* "View.MemoryView":503
14953  * return result
14954  *
14955  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
14956  * """Only used if instantiated manually by the user, or if Cython doesn't
14957  * know how to convert the type"""
14958  */
14959 
14960  /* function exit code */
14961  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
14962  goto __pyx_L0;
14963  __pyx_L1_error:;
14964  __Pyx_XDECREF(__pyx_t_1);
14965  __Pyx_XDECREF(__pyx_t_4);
14966  __Pyx_XDECREF(__pyx_t_5);
14967  __Pyx_XDECREF(__pyx_t_6);
14968  __Pyx_XDECREF(__pyx_t_8);
14969  __Pyx_XDECREF(__pyx_t_10);
14970  __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
14971  __pyx_r = 0;
14972  __pyx_L0:;
14973  __Pyx_XDECREF(__pyx_v_struct);
14974  __Pyx_XDECREF(__pyx_v_bytesvalue);
14975  __Pyx_XGIVEREF(__pyx_r);
14976  __Pyx_TraceReturn(__pyx_r, 0);
14977  __Pyx_RefNannyFinishContext();
14978  return __pyx_r;
14979 }
14980 
14981 /* "View.MemoryView":520
14982  *
14983  * @cname('getbuffer')
14984  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
14985  * if flags & PyBUF_WRITABLE and self.view.readonly:
14986  * raise ValueError("Cannot create writable memory view from read-only memoryview")
14987  */
14988 
14989 /* Python wrapper */
14990 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
14991 static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
14992  int __pyx_r;
14993  __Pyx_RefNannyDeclarations
14994  __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
14995  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
14996 
14997  /* function exit code */
14998  __Pyx_RefNannyFinishContext();
14999  return __pyx_r;
15000 }
15001 
15002 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
15003  int __pyx_r;
15004  __Pyx_TraceDeclarations
15005  __Pyx_RefNannyDeclarations
15006  int __pyx_t_1;
15007  int __pyx_t_2;
15008  PyObject *__pyx_t_3 = NULL;
15009  Py_ssize_t *__pyx_t_4;
15010  char *__pyx_t_5;
15011  void *__pyx_t_6;
15012  int __pyx_t_7;
15013  Py_ssize_t __pyx_t_8;
15014  int __pyx_lineno = 0;
15015  const char *__pyx_filename = NULL;
15016  int __pyx_clineno = 0;
15017  if (__pyx_v_info == NULL) {
15018  PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
15019  return -1;
15020  }
15021  __Pyx_RefNannySetupContext("__getbuffer__", 0);
15022  __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
15023  __Pyx_GIVEREF(__pyx_v_info->obj);
15024  __Pyx_TraceCall("__getbuffer__", __pyx_f[1], 520, 0, __PYX_ERR(1, 520, __pyx_L1_error));
15025 
15026  /* "View.MemoryView":521
15027  * @cname('getbuffer')
15028  * def __getbuffer__(self, Py_buffer *info, int flags):
15029  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
15030  * raise ValueError("Cannot create writable memory view from read-only memoryview")
15031  *
15032  */
15033  __Pyx_TraceLine(521,0,__PYX_ERR(1, 521, __pyx_L1_error))
15034  __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
15035  if (__pyx_t_2) {
15036  } else {
15037  __pyx_t_1 = __pyx_t_2;
15038  goto __pyx_L4_bool_binop_done;
15039  }
15040  __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
15041  __pyx_t_1 = __pyx_t_2;
15042  __pyx_L4_bool_binop_done:;
15043  if (unlikely(__pyx_t_1)) {
15044 
15045  /* "View.MemoryView":522
15046  * def __getbuffer__(self, Py_buffer *info, int flags):
15047  * if flags & PyBUF_WRITABLE and self.view.readonly:
15048  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
15049  *
15050  * if flags & PyBUF_ND:
15051  */
15052  __Pyx_TraceLine(522,0,__PYX_ERR(1, 522, __pyx_L1_error))
15053  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 522, __pyx_L1_error)
15054  __Pyx_GOTREF(__pyx_t_3);
15055  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15056  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15057  __PYX_ERR(1, 522, __pyx_L1_error)
15058 
15059  /* "View.MemoryView":521
15060  * @cname('getbuffer')
15061  * def __getbuffer__(self, Py_buffer *info, int flags):
15062  * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
15063  * raise ValueError("Cannot create writable memory view from read-only memoryview")
15064  *
15065  */
15066  }
15067 
15068  /* "View.MemoryView":524
15069  * raise ValueError("Cannot create writable memory view from read-only memoryview")
15070  *
15071  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
15072  * info.shape = self.view.shape
15073  * else:
15074  */
15075  __Pyx_TraceLine(524,0,__PYX_ERR(1, 524, __pyx_L1_error))
15076  __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
15077  if (__pyx_t_1) {
15078 
15079  /* "View.MemoryView":525
15080  *
15081  * if flags & PyBUF_ND:
15082  * info.shape = self.view.shape # <<<<<<<<<<<<<<
15083  * else:
15084  * info.shape = NULL
15085  */
15086  __Pyx_TraceLine(525,0,__PYX_ERR(1, 525, __pyx_L1_error))
15087  __pyx_t_4 = __pyx_v_self->view.shape;
15088  __pyx_v_info->shape = __pyx_t_4;
15089 
15090  /* "View.MemoryView":524
15091  * raise ValueError("Cannot create writable memory view from read-only memoryview")
15092  *
15093  * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
15094  * info.shape = self.view.shape
15095  * else:
15096  */
15097  goto __pyx_L6;
15098  }
15099 
15100  /* "View.MemoryView":527
15101  * info.shape = self.view.shape
15102  * else:
15103  * info.shape = NULL # <<<<<<<<<<<<<<
15104  *
15105  * if flags & PyBUF_STRIDES:
15106  */
15107  __Pyx_TraceLine(527,0,__PYX_ERR(1, 527, __pyx_L1_error))
15108  /*else*/ {
15109  __pyx_v_info->shape = NULL;
15110  }
15111  __pyx_L6:;
15112 
15113  /* "View.MemoryView":529
15114  * info.shape = NULL
15115  *
15116  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
15117  * info.strides = self.view.strides
15118  * else:
15119  */
15120  __Pyx_TraceLine(529,0,__PYX_ERR(1, 529, __pyx_L1_error))
15121  __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
15122  if (__pyx_t_1) {
15123 
15124  /* "View.MemoryView":530
15125  *
15126  * if flags & PyBUF_STRIDES:
15127  * info.strides = self.view.strides # <<<<<<<<<<<<<<
15128  * else:
15129  * info.strides = NULL
15130  */
15131  __Pyx_TraceLine(530,0,__PYX_ERR(1, 530, __pyx_L1_error))
15132  __pyx_t_4 = __pyx_v_self->view.strides;
15133  __pyx_v_info->strides = __pyx_t_4;
15134 
15135  /* "View.MemoryView":529
15136  * info.shape = NULL
15137  *
15138  * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
15139  * info.strides = self.view.strides
15140  * else:
15141  */
15142  goto __pyx_L7;
15143  }
15144 
15145  /* "View.MemoryView":532
15146  * info.strides = self.view.strides
15147  * else:
15148  * info.strides = NULL # <<<<<<<<<<<<<<
15149  *
15150  * if flags & PyBUF_INDIRECT:
15151  */
15152  __Pyx_TraceLine(532,0,__PYX_ERR(1, 532, __pyx_L1_error))
15153  /*else*/ {
15154  __pyx_v_info->strides = NULL;
15155  }
15156  __pyx_L7:;
15157 
15158  /* "View.MemoryView":534
15159  * info.strides = NULL
15160  *
15161  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
15162  * info.suboffsets = self.view.suboffsets
15163  * else:
15164  */
15165  __Pyx_TraceLine(534,0,__PYX_ERR(1, 534, __pyx_L1_error))
15166  __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
15167  if (__pyx_t_1) {
15168 
15169  /* "View.MemoryView":535
15170  *
15171  * if flags & PyBUF_INDIRECT:
15172  * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
15173  * else:
15174  * info.suboffsets = NULL
15175  */
15176  __Pyx_TraceLine(535,0,__PYX_ERR(1, 535, __pyx_L1_error))
15177  __pyx_t_4 = __pyx_v_self->view.suboffsets;
15178  __pyx_v_info->suboffsets = __pyx_t_4;
15179 
15180  /* "View.MemoryView":534
15181  * info.strides = NULL
15182  *
15183  * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
15184  * info.suboffsets = self.view.suboffsets
15185  * else:
15186  */
15187  goto __pyx_L8;
15188  }
15189 
15190  /* "View.MemoryView":537
15191  * info.suboffsets = self.view.suboffsets
15192  * else:
15193  * info.suboffsets = NULL # <<<<<<<<<<<<<<
15194  *
15195  * if flags & PyBUF_FORMAT:
15196  */
15197  __Pyx_TraceLine(537,0,__PYX_ERR(1, 537, __pyx_L1_error))
15198  /*else*/ {
15199  __pyx_v_info->suboffsets = NULL;
15200  }
15201  __pyx_L8:;
15202 
15203  /* "View.MemoryView":539
15204  * info.suboffsets = NULL
15205  *
15206  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
15207  * info.format = self.view.format
15208  * else:
15209  */
15210  __Pyx_TraceLine(539,0,__PYX_ERR(1, 539, __pyx_L1_error))
15211  __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
15212  if (__pyx_t_1) {
15213 
15214  /* "View.MemoryView":540
15215  *
15216  * if flags & PyBUF_FORMAT:
15217  * info.format = self.view.format # <<<<<<<<<<<<<<
15218  * else:
15219  * info.format = NULL
15220  */
15221  __Pyx_TraceLine(540,0,__PYX_ERR(1, 540, __pyx_L1_error))
15222  __pyx_t_5 = __pyx_v_self->view.format;
15223  __pyx_v_info->format = __pyx_t_5;
15224 
15225  /* "View.MemoryView":539
15226  * info.suboffsets = NULL
15227  *
15228  * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
15229  * info.format = self.view.format
15230  * else:
15231  */
15232  goto __pyx_L9;
15233  }
15234 
15235  /* "View.MemoryView":542
15236  * info.format = self.view.format
15237  * else:
15238  * info.format = NULL # <<<<<<<<<<<<<<
15239  *
15240  * info.buf = self.view.buf
15241  */
15242  __Pyx_TraceLine(542,0,__PYX_ERR(1, 542, __pyx_L1_error))
15243  /*else*/ {
15244  __pyx_v_info->format = NULL;
15245  }
15246  __pyx_L9:;
15247 
15248  /* "View.MemoryView":544
15249  * info.format = NULL
15250  *
15251  * info.buf = self.view.buf # <<<<<<<<<<<<<<
15252  * info.ndim = self.view.ndim
15253  * info.itemsize = self.view.itemsize
15254  */
15255  __Pyx_TraceLine(544,0,__PYX_ERR(1, 544, __pyx_L1_error))
15256  __pyx_t_6 = __pyx_v_self->view.buf;
15257  __pyx_v_info->buf = __pyx_t_6;
15258 
15259  /* "View.MemoryView":545
15260  *
15261  * info.buf = self.view.buf
15262  * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
15263  * info.itemsize = self.view.itemsize
15264  * info.len = self.view.len
15265  */
15266  __Pyx_TraceLine(545,0,__PYX_ERR(1, 545, __pyx_L1_error))
15267  __pyx_t_7 = __pyx_v_self->view.ndim;
15268  __pyx_v_info->ndim = __pyx_t_7;
15269 
15270  /* "View.MemoryView":546
15271  * info.buf = self.view.buf
15272  * info.ndim = self.view.ndim
15273  * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
15274  * info.len = self.view.len
15275  * info.readonly = self.view.readonly
15276  */
15277  __Pyx_TraceLine(546,0,__PYX_ERR(1, 546, __pyx_L1_error))
15278  __pyx_t_8 = __pyx_v_self->view.itemsize;
15279  __pyx_v_info->itemsize = __pyx_t_8;
15280 
15281  /* "View.MemoryView":547
15282  * info.ndim = self.view.ndim
15283  * info.itemsize = self.view.itemsize
15284  * info.len = self.view.len # <<<<<<<<<<<<<<
15285  * info.readonly = self.view.readonly
15286  * info.obj = self
15287  */
15288  __Pyx_TraceLine(547,0,__PYX_ERR(1, 547, __pyx_L1_error))
15289  __pyx_t_8 = __pyx_v_self->view.len;
15290  __pyx_v_info->len = __pyx_t_8;
15291 
15292  /* "View.MemoryView":548
15293  * info.itemsize = self.view.itemsize
15294  * info.len = self.view.len
15295  * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
15296  * info.obj = self
15297  *
15298  */
15299  __Pyx_TraceLine(548,0,__PYX_ERR(1, 548, __pyx_L1_error))
15300  __pyx_t_1 = __pyx_v_self->view.readonly;
15301  __pyx_v_info->readonly = __pyx_t_1;
15302 
15303  /* "View.MemoryView":549
15304  * info.len = self.view.len
15305  * info.readonly = self.view.readonly
15306  * info.obj = self # <<<<<<<<<<<<<<
15307  *
15308  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
15309  */
15310  __Pyx_TraceLine(549,0,__PYX_ERR(1, 549, __pyx_L1_error))
15311  __Pyx_INCREF(((PyObject *)__pyx_v_self));
15312  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
15313  __Pyx_GOTREF(__pyx_v_info->obj);
15314  __Pyx_DECREF(__pyx_v_info->obj);
15315  __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
15316 
15317  /* "View.MemoryView":520
15318  *
15319  * @cname('getbuffer')
15320  * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
15321  * if flags & PyBUF_WRITABLE and self.view.readonly:
15322  * raise ValueError("Cannot create writable memory view from read-only memoryview")
15323  */
15324 
15325  /* function exit code */
15326  __pyx_r = 0;
15327  goto __pyx_L0;
15328  __pyx_L1_error:;
15329  __Pyx_XDECREF(__pyx_t_3);
15330  __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15331  __pyx_r = -1;
15332  if (__pyx_v_info->obj != NULL) {
15333  __Pyx_GOTREF(__pyx_v_info->obj);
15334  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15335  }
15336  goto __pyx_L2;
15337  __pyx_L0:;
15338  if (__pyx_v_info->obj == Py_None) {
15339  __Pyx_GOTREF(__pyx_v_info->obj);
15340  __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
15341  }
15342  __pyx_L2:;
15343  __Pyx_TraceReturn(Py_None, 0);
15344  __Pyx_RefNannyFinishContext();
15345  return __pyx_r;
15346 }
15347 
15348 /* "View.MemoryView":555
15349  *
15350  * @property
15351  * def T(self): # <<<<<<<<<<<<<<
15352  * cdef _memoryviewslice result = memoryview_copy(self)
15353  * transpose_memslice(&result.from_slice)
15354  */
15355 
15356 /* Python wrapper */
15357 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
15358 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
15359  PyObject *__pyx_r = 0;
15360  __Pyx_RefNannyDeclarations
15361  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15362  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15363 
15364  /* function exit code */
15365  __Pyx_RefNannyFinishContext();
15366  return __pyx_r;
15367 }
15368 
15369 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15370  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
15371  PyObject *__pyx_r = NULL;
15372  __Pyx_TraceDeclarations
15373  __Pyx_RefNannyDeclarations
15374  PyObject *__pyx_t_1 = NULL;
15375  int __pyx_t_2;
15376  int __pyx_lineno = 0;
15377  const char *__pyx_filename = NULL;
15378  int __pyx_clineno = 0;
15379  __Pyx_RefNannySetupContext("__get__", 0);
15380  __Pyx_TraceCall("__get__", __pyx_f[1], 555, 0, __PYX_ERR(1, 555, __pyx_L1_error));
15381 
15382  /* "View.MemoryView":556
15383  * @property
15384  * def T(self):
15385  * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
15386  * transpose_memslice(&result.from_slice)
15387  * return result
15388  */
15389  __Pyx_TraceLine(556,0,__PYX_ERR(1, 556, __pyx_L1_error))
15390  __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 556, __pyx_L1_error)
15391  __Pyx_GOTREF(__pyx_t_1);
15392  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 556, __pyx_L1_error)
15393  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
15394  __pyx_t_1 = 0;
15395 
15396  /* "View.MemoryView":557
15397  * def T(self):
15398  * cdef _memoryviewslice result = memoryview_copy(self)
15399  * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
15400  * return result
15401  *
15402  */
15403  __Pyx_TraceLine(557,0,__PYX_ERR(1, 557, __pyx_L1_error))
15404  __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 557, __pyx_L1_error)
15405 
15406  /* "View.MemoryView":558
15407  * cdef _memoryviewslice result = memoryview_copy(self)
15408  * transpose_memslice(&result.from_slice)
15409  * return result # <<<<<<<<<<<<<<
15410  *
15411  * @property
15412  */
15413  __Pyx_TraceLine(558,0,__PYX_ERR(1, 558, __pyx_L1_error))
15414  __Pyx_XDECREF(__pyx_r);
15415  __Pyx_INCREF(((PyObject *)__pyx_v_result));
15416  __pyx_r = ((PyObject *)__pyx_v_result);
15417  goto __pyx_L0;
15418 
15419  /* "View.MemoryView":555
15420  *
15421  * @property
15422  * def T(self): # <<<<<<<<<<<<<<
15423  * cdef _memoryviewslice result = memoryview_copy(self)
15424  * transpose_memslice(&result.from_slice)
15425  */
15426 
15427  /* function exit code */
15428  __pyx_L1_error:;
15429  __Pyx_XDECREF(__pyx_t_1);
15430  __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15431  __pyx_r = NULL;
15432  __pyx_L0:;
15433  __Pyx_XDECREF((PyObject *)__pyx_v_result);
15434  __Pyx_XGIVEREF(__pyx_r);
15435  __Pyx_TraceReturn(__pyx_r, 0);
15436  __Pyx_RefNannyFinishContext();
15437  return __pyx_r;
15438 }
15439 
15440 /* "View.MemoryView":561
15441  *
15442  * @property
15443  * def base(self): # <<<<<<<<<<<<<<
15444  * return self.obj
15445  *
15446  */
15447 
15448 /* Python wrapper */
15449 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
15450 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
15451  PyObject *__pyx_r = 0;
15452  __Pyx_RefNannyDeclarations
15453  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15454  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15455 
15456  /* function exit code */
15457  __Pyx_RefNannyFinishContext();
15458  return __pyx_r;
15459 }
15460 
15461 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15462  PyObject *__pyx_r = NULL;
15463  __Pyx_TraceDeclarations
15464  __Pyx_RefNannyDeclarations
15465  int __pyx_lineno = 0;
15466  const char *__pyx_filename = NULL;
15467  int __pyx_clineno = 0;
15468  __Pyx_RefNannySetupContext("__get__", 0);
15469  __Pyx_TraceCall("__get__", __pyx_f[1], 561, 0, __PYX_ERR(1, 561, __pyx_L1_error));
15470 
15471  /* "View.MemoryView":562
15472  * @property
15473  * def base(self):
15474  * return self.obj # <<<<<<<<<<<<<<
15475  *
15476  * @property
15477  */
15478  __Pyx_TraceLine(562,0,__PYX_ERR(1, 562, __pyx_L1_error))
15479  __Pyx_XDECREF(__pyx_r);
15480  __Pyx_INCREF(__pyx_v_self->obj);
15481  __pyx_r = __pyx_v_self->obj;
15482  goto __pyx_L0;
15483 
15484  /* "View.MemoryView":561
15485  *
15486  * @property
15487  * def base(self): # <<<<<<<<<<<<<<
15488  * return self.obj
15489  *
15490  */
15491 
15492  /* function exit code */
15493  __pyx_L1_error:;
15494  __Pyx_AddTraceback("View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15495  __pyx_r = NULL;
15496  __pyx_L0:;
15497  __Pyx_XGIVEREF(__pyx_r);
15498  __Pyx_TraceReturn(__pyx_r, 0);
15499  __Pyx_RefNannyFinishContext();
15500  return __pyx_r;
15501 }
15502 
15503 /* "View.MemoryView":565
15504  *
15505  * @property
15506  * def shape(self): # <<<<<<<<<<<<<<
15507  * return tuple([length for length in self.view.shape[:self.view.ndim]])
15508  *
15509  */
15510 
15511 /* Python wrapper */
15512 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
15513 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
15514  PyObject *__pyx_r = 0;
15515  __Pyx_RefNannyDeclarations
15516  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15517  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15518 
15519  /* function exit code */
15520  __Pyx_RefNannyFinishContext();
15521  return __pyx_r;
15522 }
15523 
15524 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15525  Py_ssize_t __pyx_v_length;
15526  PyObject *__pyx_r = NULL;
15527  __Pyx_TraceDeclarations
15528  __Pyx_RefNannyDeclarations
15529  PyObject *__pyx_t_1 = NULL;
15530  Py_ssize_t *__pyx_t_2;
15531  Py_ssize_t *__pyx_t_3;
15532  Py_ssize_t *__pyx_t_4;
15533  PyObject *__pyx_t_5 = NULL;
15534  int __pyx_lineno = 0;
15535  const char *__pyx_filename = NULL;
15536  int __pyx_clineno = 0;
15537  __Pyx_RefNannySetupContext("__get__", 0);
15538  __Pyx_TraceCall("__get__", __pyx_f[1], 565, 0, __PYX_ERR(1, 565, __pyx_L1_error));
15539 
15540  /* "View.MemoryView":566
15541  * @property
15542  * def shape(self):
15543  * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
15544  *
15545  * @property
15546  */
15547  __Pyx_TraceLine(566,0,__PYX_ERR(1, 566, __pyx_L1_error))
15548  __Pyx_XDECREF(__pyx_r);
15549  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 566, __pyx_L1_error)
15550  __Pyx_GOTREF(__pyx_t_1);
15551  __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
15552  for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
15553  __pyx_t_2 = __pyx_t_4;
15554  __pyx_v_length = (__pyx_t_2[0]);
15555  __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 566, __pyx_L1_error)
15556  __Pyx_GOTREF(__pyx_t_5);
15557  if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 566, __pyx_L1_error)
15558  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15559  }
15560  __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 566, __pyx_L1_error)
15561  __Pyx_GOTREF(__pyx_t_5);
15562  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15563  __pyx_r = __pyx_t_5;
15564  __pyx_t_5 = 0;
15565  goto __pyx_L0;
15566 
15567  /* "View.MemoryView":565
15568  *
15569  * @property
15570  * def shape(self): # <<<<<<<<<<<<<<
15571  * return tuple([length for length in self.view.shape[:self.view.ndim]])
15572  *
15573  */
15574 
15575  /* function exit code */
15576  __pyx_L1_error:;
15577  __Pyx_XDECREF(__pyx_t_1);
15578  __Pyx_XDECREF(__pyx_t_5);
15579  __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15580  __pyx_r = NULL;
15581  __pyx_L0:;
15582  __Pyx_XGIVEREF(__pyx_r);
15583  __Pyx_TraceReturn(__pyx_r, 0);
15584  __Pyx_RefNannyFinishContext();
15585  return __pyx_r;
15586 }
15587 
15588 /* "View.MemoryView":569
15589  *
15590  * @property
15591  * def strides(self): # <<<<<<<<<<<<<<
15592  * if self.view.strides == NULL:
15593  *
15594  */
15595 
15596 /* Python wrapper */
15597 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
15598 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
15599  PyObject *__pyx_r = 0;
15600  __Pyx_RefNannyDeclarations
15601  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15602  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15603 
15604  /* function exit code */
15605  __Pyx_RefNannyFinishContext();
15606  return __pyx_r;
15607 }
15608 
15609 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15610  Py_ssize_t __pyx_v_stride;
15611  PyObject *__pyx_r = NULL;
15612  __Pyx_TraceDeclarations
15613  __Pyx_RefNannyDeclarations
15614  int __pyx_t_1;
15615  PyObject *__pyx_t_2 = NULL;
15616  Py_ssize_t *__pyx_t_3;
15617  Py_ssize_t *__pyx_t_4;
15618  Py_ssize_t *__pyx_t_5;
15619  PyObject *__pyx_t_6 = NULL;
15620  int __pyx_lineno = 0;
15621  const char *__pyx_filename = NULL;
15622  int __pyx_clineno = 0;
15623  __Pyx_RefNannySetupContext("__get__", 0);
15624  __Pyx_TraceCall("__get__", __pyx_f[1], 569, 0, __PYX_ERR(1, 569, __pyx_L1_error));
15625 
15626  /* "View.MemoryView":570
15627  * @property
15628  * def strides(self):
15629  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
15630  *
15631  * raise ValueError("Buffer view does not expose strides")
15632  */
15633  __Pyx_TraceLine(570,0,__PYX_ERR(1, 570, __pyx_L1_error))
15634  __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
15635  if (unlikely(__pyx_t_1)) {
15636 
15637  /* "View.MemoryView":572
15638  * if self.view.strides == NULL:
15639  *
15640  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
15641  *
15642  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
15643  */
15644  __Pyx_TraceLine(572,0,__PYX_ERR(1, 572, __pyx_L1_error))
15645  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
15646  __Pyx_GOTREF(__pyx_t_2);
15647  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
15648  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15649  __PYX_ERR(1, 572, __pyx_L1_error)
15650 
15651  /* "View.MemoryView":570
15652  * @property
15653  * def strides(self):
15654  * if self.view.strides == NULL: # <<<<<<<<<<<<<<
15655  *
15656  * raise ValueError("Buffer view does not expose strides")
15657  */
15658  }
15659 
15660  /* "View.MemoryView":574
15661  * raise ValueError("Buffer view does not expose strides")
15662  *
15663  * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
15664  *
15665  * @property
15666  */
15667  __Pyx_TraceLine(574,0,__PYX_ERR(1, 574, __pyx_L1_error))
15668  __Pyx_XDECREF(__pyx_r);
15669  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 574, __pyx_L1_error)
15670  __Pyx_GOTREF(__pyx_t_2);
15671  __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
15672  for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
15673  __pyx_t_3 = __pyx_t_5;
15674  __pyx_v_stride = (__pyx_t_3[0]);
15675  __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 574, __pyx_L1_error)
15676  __Pyx_GOTREF(__pyx_t_6);
15677  if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 574, __pyx_L1_error)
15678  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
15679  }
15680  __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 574, __pyx_L1_error)
15681  __Pyx_GOTREF(__pyx_t_6);
15682  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15683  __pyx_r = __pyx_t_6;
15684  __pyx_t_6 = 0;
15685  goto __pyx_L0;
15686 
15687  /* "View.MemoryView":569
15688  *
15689  * @property
15690  * def strides(self): # <<<<<<<<<<<<<<
15691  * if self.view.strides == NULL:
15692  *
15693  */
15694 
15695  /* function exit code */
15696  __pyx_L1_error:;
15697  __Pyx_XDECREF(__pyx_t_2);
15698  __Pyx_XDECREF(__pyx_t_6);
15699  __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15700  __pyx_r = NULL;
15701  __pyx_L0:;
15702  __Pyx_XGIVEREF(__pyx_r);
15703  __Pyx_TraceReturn(__pyx_r, 0);
15704  __Pyx_RefNannyFinishContext();
15705  return __pyx_r;
15706 }
15707 
15708 /* "View.MemoryView":577
15709  *
15710  * @property
15711  * def suboffsets(self): # <<<<<<<<<<<<<<
15712  * if self.view.suboffsets == NULL:
15713  * return (-1,) * self.view.ndim
15714  */
15715 
15716 /* Python wrapper */
15717 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
15718 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
15719  PyObject *__pyx_r = 0;
15720  __Pyx_RefNannyDeclarations
15721  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15722  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15723 
15724  /* function exit code */
15725  __Pyx_RefNannyFinishContext();
15726  return __pyx_r;
15727 }
15728 
15729 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15730  Py_ssize_t __pyx_v_suboffset;
15731  PyObject *__pyx_r = NULL;
15732  __Pyx_TraceDeclarations
15733  __Pyx_RefNannyDeclarations
15734  int __pyx_t_1;
15735  PyObject *__pyx_t_2 = NULL;
15736  PyObject *__pyx_t_3 = NULL;
15737  Py_ssize_t *__pyx_t_4;
15738  Py_ssize_t *__pyx_t_5;
15739  Py_ssize_t *__pyx_t_6;
15740  int __pyx_lineno = 0;
15741  const char *__pyx_filename = NULL;
15742  int __pyx_clineno = 0;
15743  __Pyx_RefNannySetupContext("__get__", 0);
15744  __Pyx_TraceCall("__get__", __pyx_f[1], 577, 0, __PYX_ERR(1, 577, __pyx_L1_error));
15745 
15746  /* "View.MemoryView":578
15747  * @property
15748  * def suboffsets(self):
15749  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
15750  * return (-1,) * self.view.ndim
15751  *
15752  */
15753  __Pyx_TraceLine(578,0,__PYX_ERR(1, 578, __pyx_L1_error))
15754  __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
15755  if (__pyx_t_1) {
15756 
15757  /* "View.MemoryView":579
15758  * def suboffsets(self):
15759  * if self.view.suboffsets == NULL:
15760  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
15761  *
15762  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
15763  */
15764  __Pyx_TraceLine(579,0,__PYX_ERR(1, 579, __pyx_L1_error))
15765  __Pyx_XDECREF(__pyx_r);
15766  __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
15767  __Pyx_GOTREF(__pyx_t_2);
15768  __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__19, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
15769  __Pyx_GOTREF(__pyx_t_3);
15770  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15771  __pyx_r = __pyx_t_3;
15772  __pyx_t_3 = 0;
15773  goto __pyx_L0;
15774 
15775  /* "View.MemoryView":578
15776  * @property
15777  * def suboffsets(self):
15778  * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
15779  * return (-1,) * self.view.ndim
15780  *
15781  */
15782  }
15783 
15784  /* "View.MemoryView":581
15785  * return (-1,) * self.view.ndim
15786  *
15787  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
15788  *
15789  * @property
15790  */
15791  __Pyx_TraceLine(581,0,__PYX_ERR(1, 581, __pyx_L1_error))
15792  __Pyx_XDECREF(__pyx_r);
15793  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 581, __pyx_L1_error)
15794  __Pyx_GOTREF(__pyx_t_3);
15795  __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
15796  for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
15797  __pyx_t_4 = __pyx_t_6;
15798  __pyx_v_suboffset = (__pyx_t_4[0]);
15799  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 581, __pyx_L1_error)
15800  __Pyx_GOTREF(__pyx_t_2);
15801  if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 581, __pyx_L1_error)
15802  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
15803  }
15804  __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 581, __pyx_L1_error)
15805  __Pyx_GOTREF(__pyx_t_2);
15806  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15807  __pyx_r = __pyx_t_2;
15808  __pyx_t_2 = 0;
15809  goto __pyx_L0;
15810 
15811  /* "View.MemoryView":577
15812  *
15813  * @property
15814  * def suboffsets(self): # <<<<<<<<<<<<<<
15815  * if self.view.suboffsets == NULL:
15816  * return (-1,) * self.view.ndim
15817  */
15818 
15819  /* function exit code */
15820  __pyx_L1_error:;
15821  __Pyx_XDECREF(__pyx_t_2);
15822  __Pyx_XDECREF(__pyx_t_3);
15823  __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15824  __pyx_r = NULL;
15825  __pyx_L0:;
15826  __Pyx_XGIVEREF(__pyx_r);
15827  __Pyx_TraceReturn(__pyx_r, 0);
15828  __Pyx_RefNannyFinishContext();
15829  return __pyx_r;
15830 }
15831 
15832 /* "View.MemoryView":584
15833  *
15834  * @property
15835  * def ndim(self): # <<<<<<<<<<<<<<
15836  * return self.view.ndim
15837  *
15838  */
15839 
15840 /* Python wrapper */
15841 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
15842 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
15843  PyObject *__pyx_r = 0;
15844  __Pyx_RefNannyDeclarations
15845  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15846  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15847 
15848  /* function exit code */
15849  __Pyx_RefNannyFinishContext();
15850  return __pyx_r;
15851 }
15852 
15853 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15854  PyObject *__pyx_r = NULL;
15855  __Pyx_TraceDeclarations
15856  __Pyx_RefNannyDeclarations
15857  PyObject *__pyx_t_1 = NULL;
15858  int __pyx_lineno = 0;
15859  const char *__pyx_filename = NULL;
15860  int __pyx_clineno = 0;
15861  __Pyx_RefNannySetupContext("__get__", 0);
15862  __Pyx_TraceCall("__get__", __pyx_f[1], 584, 0, __PYX_ERR(1, 584, __pyx_L1_error));
15863 
15864  /* "View.MemoryView":585
15865  * @property
15866  * def ndim(self):
15867  * return self.view.ndim # <<<<<<<<<<<<<<
15868  *
15869  * @property
15870  */
15871  __Pyx_TraceLine(585,0,__PYX_ERR(1, 585, __pyx_L1_error))
15872  __Pyx_XDECREF(__pyx_r);
15873  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 585, __pyx_L1_error)
15874  __Pyx_GOTREF(__pyx_t_1);
15875  __pyx_r = __pyx_t_1;
15876  __pyx_t_1 = 0;
15877  goto __pyx_L0;
15878 
15879  /* "View.MemoryView":584
15880  *
15881  * @property
15882  * def ndim(self): # <<<<<<<<<<<<<<
15883  * return self.view.ndim
15884  *
15885  */
15886 
15887  /* function exit code */
15888  __pyx_L1_error:;
15889  __Pyx_XDECREF(__pyx_t_1);
15890  __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15891  __pyx_r = NULL;
15892  __pyx_L0:;
15893  __Pyx_XGIVEREF(__pyx_r);
15894  __Pyx_TraceReturn(__pyx_r, 0);
15895  __Pyx_RefNannyFinishContext();
15896  return __pyx_r;
15897 }
15898 
15899 /* "View.MemoryView":588
15900  *
15901  * @property
15902  * def itemsize(self): # <<<<<<<<<<<<<<
15903  * return self.view.itemsize
15904  *
15905  */
15906 
15907 /* Python wrapper */
15908 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
15909 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
15910  PyObject *__pyx_r = 0;
15911  __Pyx_RefNannyDeclarations
15912  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15913  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15914 
15915  /* function exit code */
15916  __Pyx_RefNannyFinishContext();
15917  return __pyx_r;
15918 }
15919 
15920 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15921  PyObject *__pyx_r = NULL;
15922  __Pyx_TraceDeclarations
15923  __Pyx_RefNannyDeclarations
15924  PyObject *__pyx_t_1 = NULL;
15925  int __pyx_lineno = 0;
15926  const char *__pyx_filename = NULL;
15927  int __pyx_clineno = 0;
15928  __Pyx_RefNannySetupContext("__get__", 0);
15929  __Pyx_TraceCall("__get__", __pyx_f[1], 588, 0, __PYX_ERR(1, 588, __pyx_L1_error));
15930 
15931  /* "View.MemoryView":589
15932  * @property
15933  * def itemsize(self):
15934  * return self.view.itemsize # <<<<<<<<<<<<<<
15935  *
15936  * @property
15937  */
15938  __Pyx_TraceLine(589,0,__PYX_ERR(1, 589, __pyx_L1_error))
15939  __Pyx_XDECREF(__pyx_r);
15940  __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 589, __pyx_L1_error)
15941  __Pyx_GOTREF(__pyx_t_1);
15942  __pyx_r = __pyx_t_1;
15943  __pyx_t_1 = 0;
15944  goto __pyx_L0;
15945 
15946  /* "View.MemoryView":588
15947  *
15948  * @property
15949  * def itemsize(self): # <<<<<<<<<<<<<<
15950  * return self.view.itemsize
15951  *
15952  */
15953 
15954  /* function exit code */
15955  __pyx_L1_error:;
15956  __Pyx_XDECREF(__pyx_t_1);
15957  __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
15958  __pyx_r = NULL;
15959  __pyx_L0:;
15960  __Pyx_XGIVEREF(__pyx_r);
15961  __Pyx_TraceReturn(__pyx_r, 0);
15962  __Pyx_RefNannyFinishContext();
15963  return __pyx_r;
15964 }
15965 
15966 /* "View.MemoryView":592
15967  *
15968  * @property
15969  * def nbytes(self): # <<<<<<<<<<<<<<
15970  * return self.size * self.view.itemsize
15971  *
15972  */
15973 
15974 /* Python wrapper */
15975 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
15976 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
15977  PyObject *__pyx_r = 0;
15978  __Pyx_RefNannyDeclarations
15979  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
15980  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
15981 
15982  /* function exit code */
15983  __Pyx_RefNannyFinishContext();
15984  return __pyx_r;
15985 }
15986 
15987 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
15988  PyObject *__pyx_r = NULL;
15989  __Pyx_TraceDeclarations
15990  __Pyx_RefNannyDeclarations
15991  PyObject *__pyx_t_1 = NULL;
15992  PyObject *__pyx_t_2 = NULL;
15993  PyObject *__pyx_t_3 = NULL;
15994  int __pyx_lineno = 0;
15995  const char *__pyx_filename = NULL;
15996  int __pyx_clineno = 0;
15997  __Pyx_RefNannySetupContext("__get__", 0);
15998  __Pyx_TraceCall("__get__", __pyx_f[1], 592, 0, __PYX_ERR(1, 592, __pyx_L1_error));
15999 
16000  /* "View.MemoryView":593
16001  * @property
16002  * def nbytes(self):
16003  * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
16004  *
16005  * @property
16006  */
16007  __Pyx_TraceLine(593,0,__PYX_ERR(1, 593, __pyx_L1_error))
16008  __Pyx_XDECREF(__pyx_r);
16009  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 593, __pyx_L1_error)
16010  __Pyx_GOTREF(__pyx_t_1);
16011  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 593, __pyx_L1_error)
16012  __Pyx_GOTREF(__pyx_t_2);
16013  __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 593, __pyx_L1_error)
16014  __Pyx_GOTREF(__pyx_t_3);
16015  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16016  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16017  __pyx_r = __pyx_t_3;
16018  __pyx_t_3 = 0;
16019  goto __pyx_L0;
16020 
16021  /* "View.MemoryView":592
16022  *
16023  * @property
16024  * def nbytes(self): # <<<<<<<<<<<<<<
16025  * return self.size * self.view.itemsize
16026  *
16027  */
16028 
16029  /* function exit code */
16030  __pyx_L1_error:;
16031  __Pyx_XDECREF(__pyx_t_1);
16032  __Pyx_XDECREF(__pyx_t_2);
16033  __Pyx_XDECREF(__pyx_t_3);
16034  __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16035  __pyx_r = NULL;
16036  __pyx_L0:;
16037  __Pyx_XGIVEREF(__pyx_r);
16038  __Pyx_TraceReturn(__pyx_r, 0);
16039  __Pyx_RefNannyFinishContext();
16040  return __pyx_r;
16041 }
16042 
16043 /* "View.MemoryView":596
16044  *
16045  * @property
16046  * def size(self): # <<<<<<<<<<<<<<
16047  * if self._size is None:
16048  * result = 1
16049  */
16050 
16051 /* Python wrapper */
16052 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
16053 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
16054  PyObject *__pyx_r = 0;
16055  __Pyx_RefNannyDeclarations
16056  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
16057  __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
16058 
16059  /* function exit code */
16060  __Pyx_RefNannyFinishContext();
16061  return __pyx_r;
16062 }
16063 
16064 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
16065  PyObject *__pyx_v_result = NULL;
16066  PyObject *__pyx_v_length = NULL;
16067  PyObject *__pyx_r = NULL;
16068  __Pyx_TraceDeclarations
16069  __Pyx_RefNannyDeclarations
16070  int __pyx_t_1;
16071  int __pyx_t_2;
16072  Py_ssize_t *__pyx_t_3;
16073  Py_ssize_t *__pyx_t_4;
16074  Py_ssize_t *__pyx_t_5;
16075  PyObject *__pyx_t_6 = NULL;
16076  int __pyx_lineno = 0;
16077  const char *__pyx_filename = NULL;
16078  int __pyx_clineno = 0;
16079  __Pyx_RefNannySetupContext("__get__", 0);
16080  __Pyx_TraceCall("__get__", __pyx_f[1], 596, 0, __PYX_ERR(1, 596, __pyx_L1_error));
16081 
16082  /* "View.MemoryView":597
16083  * @property
16084  * def size(self):
16085  * if self._size is None: # <<<<<<<<<<<<<<
16086  * result = 1
16087  *
16088  */
16089  __Pyx_TraceLine(597,0,__PYX_ERR(1, 597, __pyx_L1_error))
16090  __pyx_t_1 = (__pyx_v_self->_size == Py_None);
16091  __pyx_t_2 = (__pyx_t_1 != 0);
16092  if (__pyx_t_2) {
16093 
16094  /* "View.MemoryView":598
16095  * def size(self):
16096  * if self._size is None:
16097  * result = 1 # <<<<<<<<<<<<<<
16098  *
16099  * for length in self.view.shape[:self.view.ndim]:
16100  */
16101  __Pyx_TraceLine(598,0,__PYX_ERR(1, 598, __pyx_L1_error))
16102  __Pyx_INCREF(__pyx_int_1);
16103  __pyx_v_result = __pyx_int_1;
16104 
16105  /* "View.MemoryView":600
16106  * result = 1
16107  *
16108  * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
16109  * result *= length
16110  *
16111  */
16112  __Pyx_TraceLine(600,0,__PYX_ERR(1, 600, __pyx_L1_error))
16113  __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
16114  for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
16115  __pyx_t_3 = __pyx_t_5;
16116  __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 600, __pyx_L1_error)
16117  __Pyx_GOTREF(__pyx_t_6);
16118  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
16119  __pyx_t_6 = 0;
16120 
16121  /* "View.MemoryView":601
16122  *
16123  * for length in self.view.shape[:self.view.ndim]:
16124  * result *= length # <<<<<<<<<<<<<<
16125  *
16126  * self._size = result
16127  */
16128  __Pyx_TraceLine(601,0,__PYX_ERR(1, 601, __pyx_L1_error))
16129  __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 601, __pyx_L1_error)
16130  __Pyx_GOTREF(__pyx_t_6);
16131  __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
16132  __pyx_t_6 = 0;
16133  }
16134 
16135  /* "View.MemoryView":603
16136  * result *= length
16137  *
16138  * self._size = result # <<<<<<<<<<<<<<
16139  *
16140  * return self._size
16141  */
16142  __Pyx_TraceLine(603,0,__PYX_ERR(1, 603, __pyx_L1_error))
16143  __Pyx_INCREF(__pyx_v_result);
16144  __Pyx_GIVEREF(__pyx_v_result);
16145  __Pyx_GOTREF(__pyx_v_self->_size);
16146  __Pyx_DECREF(__pyx_v_self->_size);
16147  __pyx_v_self->_size = __pyx_v_result;
16148 
16149  /* "View.MemoryView":597
16150  * @property
16151  * def size(self):
16152  * if self._size is None: # <<<<<<<<<<<<<<
16153  * result = 1
16154  *
16155  */
16156  }
16157 
16158  /* "View.MemoryView":605
16159  * self._size = result
16160  *
16161  * return self._size # <<<<<<<<<<<<<<
16162  *
16163  * def __len__(self):
16164  */
16165  __Pyx_TraceLine(605,0,__PYX_ERR(1, 605, __pyx_L1_error))
16166  __Pyx_XDECREF(__pyx_r);
16167  __Pyx_INCREF(__pyx_v_self->_size);
16168  __pyx_r = __pyx_v_self->_size;
16169  goto __pyx_L0;
16170 
16171  /* "View.MemoryView":596
16172  *
16173  * @property
16174  * def size(self): # <<<<<<<<<<<<<<
16175  * if self._size is None:
16176  * result = 1
16177  */
16178 
16179  /* function exit code */
16180  __pyx_L1_error:;
16181  __Pyx_XDECREF(__pyx_t_6);
16182  __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16183  __pyx_r = NULL;
16184  __pyx_L0:;
16185  __Pyx_XDECREF(__pyx_v_result);
16186  __Pyx_XDECREF(__pyx_v_length);
16187  __Pyx_XGIVEREF(__pyx_r);
16188  __Pyx_TraceReturn(__pyx_r, 0);
16189  __Pyx_RefNannyFinishContext();
16190  return __pyx_r;
16191 }
16192 
16193 /* "View.MemoryView":607
16194  * return self._size
16195  *
16196  * def __len__(self): # <<<<<<<<<<<<<<
16197  * if self.view.ndim >= 1:
16198  * return self.view.shape[0]
16199  */
16200 
16201 /* Python wrapper */
16202 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
16203 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
16204  Py_ssize_t __pyx_r;
16205  __Pyx_RefNannyDeclarations
16206  __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
16207  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
16208 
16209  /* function exit code */
16210  __Pyx_RefNannyFinishContext();
16211  return __pyx_r;
16212 }
16213 
16214 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
16215  Py_ssize_t __pyx_r;
16216  __Pyx_TraceDeclarations
16217  __Pyx_RefNannyDeclarations
16218  int __pyx_t_1;
16219  int __pyx_lineno = 0;
16220  const char *__pyx_filename = NULL;
16221  int __pyx_clineno = 0;
16222  __Pyx_RefNannySetupContext("__len__", 0);
16223  __Pyx_TraceCall("__len__", __pyx_f[1], 607, 0, __PYX_ERR(1, 607, __pyx_L1_error));
16224 
16225  /* "View.MemoryView":608
16226  *
16227  * def __len__(self):
16228  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
16229  * return self.view.shape[0]
16230  *
16231  */
16232  __Pyx_TraceLine(608,0,__PYX_ERR(1, 608, __pyx_L1_error))
16233  __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
16234  if (__pyx_t_1) {
16235 
16236  /* "View.MemoryView":609
16237  * def __len__(self):
16238  * if self.view.ndim >= 1:
16239  * return self.view.shape[0] # <<<<<<<<<<<<<<
16240  *
16241  * return 0
16242  */
16243  __Pyx_TraceLine(609,0,__PYX_ERR(1, 609, __pyx_L1_error))
16244  __pyx_r = (__pyx_v_self->view.shape[0]);
16245  goto __pyx_L0;
16246 
16247  /* "View.MemoryView":608
16248  *
16249  * def __len__(self):
16250  * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
16251  * return self.view.shape[0]
16252  *
16253  */
16254  }
16255 
16256  /* "View.MemoryView":611
16257  * return self.view.shape[0]
16258  *
16259  * return 0 # <<<<<<<<<<<<<<
16260  *
16261  * def __repr__(self):
16262  */
16263  __Pyx_TraceLine(611,0,__PYX_ERR(1, 611, __pyx_L1_error))
16264  __pyx_r = 0;
16265  goto __pyx_L0;
16266 
16267  /* "View.MemoryView":607
16268  * return self._size
16269  *
16270  * def __len__(self): # <<<<<<<<<<<<<<
16271  * if self.view.ndim >= 1:
16272  * return self.view.shape[0]
16273  */
16274 
16275  /* function exit code */
16276  __pyx_L1_error:;
16277  __Pyx_AddTraceback("View.MemoryView.memoryview.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16278  __pyx_r = -1;
16279  __pyx_L0:;
16280  __Pyx_TraceReturn(Py_None, 0);
16281  __Pyx_RefNannyFinishContext();
16282  return __pyx_r;
16283 }
16284 
16285 /* "View.MemoryView":613
16286  * return 0
16287  *
16288  * def __repr__(self): # <<<<<<<<<<<<<<
16289  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
16290  * id(self))
16291  */
16292 
16293 /* Python wrapper */
16294 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
16295 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
16296  PyObject *__pyx_r = 0;
16297  __Pyx_RefNannyDeclarations
16298  __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
16299  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
16300 
16301  /* function exit code */
16302  __Pyx_RefNannyFinishContext();
16303  return __pyx_r;
16304 }
16305 
16306 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
16307  PyObject *__pyx_r = NULL;
16308  __Pyx_TraceDeclarations
16309  __Pyx_RefNannyDeclarations
16310  PyObject *__pyx_t_1 = NULL;
16311  PyObject *__pyx_t_2 = NULL;
16312  PyObject *__pyx_t_3 = NULL;
16313  int __pyx_lineno = 0;
16314  const char *__pyx_filename = NULL;
16315  int __pyx_clineno = 0;
16316  __Pyx_RefNannySetupContext("__repr__", 0);
16317  __Pyx_TraceCall("__repr__", __pyx_f[1], 613, 0, __PYX_ERR(1, 613, __pyx_L1_error));
16318 
16319  /* "View.MemoryView":614
16320  *
16321  * def __repr__(self):
16322  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
16323  * id(self))
16324  *
16325  */
16326  __Pyx_TraceLine(614,0,__PYX_ERR(1, 614, __pyx_L1_error))
16327  __Pyx_XDECREF(__pyx_r);
16328  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 614, __pyx_L1_error)
16329  __Pyx_GOTREF(__pyx_t_1);
16330  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 614, __pyx_L1_error)
16331  __Pyx_GOTREF(__pyx_t_2);
16332  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16333  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 614, __pyx_L1_error)
16334  __Pyx_GOTREF(__pyx_t_1);
16335  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16336 
16337  /* "View.MemoryView":615
16338  * def __repr__(self):
16339  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
16340  * id(self)) # <<<<<<<<<<<<<<
16341  *
16342  * def __str__(self):
16343  */
16344  __Pyx_TraceLine(615,0,__PYX_ERR(1, 615, __pyx_L1_error))
16345  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 615, __pyx_L1_error)
16346  __Pyx_GOTREF(__pyx_t_2);
16347 
16348  /* "View.MemoryView":614
16349  *
16350  * def __repr__(self):
16351  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
16352  * id(self))
16353  *
16354  */
16355  __Pyx_TraceLine(614,0,__PYX_ERR(1, 614, __pyx_L1_error))
16356  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 614, __pyx_L1_error)
16357  __Pyx_GOTREF(__pyx_t_3);
16358  __Pyx_GIVEREF(__pyx_t_1);
16359  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
16360  __Pyx_GIVEREF(__pyx_t_2);
16361  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
16362  __pyx_t_1 = 0;
16363  __pyx_t_2 = 0;
16364  __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 614, __pyx_L1_error)
16365  __Pyx_GOTREF(__pyx_t_2);
16366  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16367  __pyx_r = __pyx_t_2;
16368  __pyx_t_2 = 0;
16369  goto __pyx_L0;
16370 
16371  /* "View.MemoryView":613
16372  * return 0
16373  *
16374  * def __repr__(self): # <<<<<<<<<<<<<<
16375  * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
16376  * id(self))
16377  */
16378 
16379  /* function exit code */
16380  __pyx_L1_error:;
16381  __Pyx_XDECREF(__pyx_t_1);
16382  __Pyx_XDECREF(__pyx_t_2);
16383  __Pyx_XDECREF(__pyx_t_3);
16384  __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16385  __pyx_r = NULL;
16386  __pyx_L0:;
16387  __Pyx_XGIVEREF(__pyx_r);
16388  __Pyx_TraceReturn(__pyx_r, 0);
16389  __Pyx_RefNannyFinishContext();
16390  return __pyx_r;
16391 }
16392 
16393 /* "View.MemoryView":617
16394  * id(self))
16395  *
16396  * def __str__(self): # <<<<<<<<<<<<<<
16397  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
16398  *
16399  */
16400 
16401 /* Python wrapper */
16402 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
16403 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
16404  PyObject *__pyx_r = 0;
16405  __Pyx_RefNannyDeclarations
16406  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
16407  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
16408 
16409  /* function exit code */
16410  __Pyx_RefNannyFinishContext();
16411  return __pyx_r;
16412 }
16413 
16414 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
16415  PyObject *__pyx_r = NULL;
16416  __Pyx_TraceDeclarations
16417  __Pyx_RefNannyDeclarations
16418  PyObject *__pyx_t_1 = NULL;
16419  PyObject *__pyx_t_2 = NULL;
16420  int __pyx_lineno = 0;
16421  const char *__pyx_filename = NULL;
16422  int __pyx_clineno = 0;
16423  __Pyx_RefNannySetupContext("__str__", 0);
16424  __Pyx_TraceCall("__str__", __pyx_f[1], 617, 0, __PYX_ERR(1, 617, __pyx_L1_error));
16425 
16426  /* "View.MemoryView":618
16427  *
16428  * def __str__(self):
16429  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
16430  *
16431  *
16432  */
16433  __Pyx_TraceLine(618,0,__PYX_ERR(1, 618, __pyx_L1_error))
16434  __Pyx_XDECREF(__pyx_r);
16435  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16436  __Pyx_GOTREF(__pyx_t_1);
16437  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error)
16438  __Pyx_GOTREF(__pyx_t_2);
16439  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16440  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16441  __Pyx_GOTREF(__pyx_t_1);
16442  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16443  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 618, __pyx_L1_error)
16444  __Pyx_GOTREF(__pyx_t_2);
16445  __Pyx_GIVEREF(__pyx_t_1);
16446  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
16447  __pyx_t_1 = 0;
16448  __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 618, __pyx_L1_error)
16449  __Pyx_GOTREF(__pyx_t_1);
16450  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16451  __pyx_r = __pyx_t_1;
16452  __pyx_t_1 = 0;
16453  goto __pyx_L0;
16454 
16455  /* "View.MemoryView":617
16456  * id(self))
16457  *
16458  * def __str__(self): # <<<<<<<<<<<<<<
16459  * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
16460  *
16461  */
16462 
16463  /* function exit code */
16464  __pyx_L1_error:;
16465  __Pyx_XDECREF(__pyx_t_1);
16466  __Pyx_XDECREF(__pyx_t_2);
16467  __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16468  __pyx_r = NULL;
16469  __pyx_L0:;
16470  __Pyx_XGIVEREF(__pyx_r);
16471  __Pyx_TraceReturn(__pyx_r, 0);
16472  __Pyx_RefNannyFinishContext();
16473  return __pyx_r;
16474 }
16475 
16476 /* "View.MemoryView":621
16477  *
16478  *
16479  * def is_c_contig(self): # <<<<<<<<<<<<<<
16480  * cdef __Pyx_memviewslice *mslice
16481  * cdef __Pyx_memviewslice tmp
16482  */
16483 
16484 /* Python wrapper */
16485 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16486 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_17is_c_contig = {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0};
16487 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16488  PyObject *__pyx_r = 0;
16489  __Pyx_RefNannyDeclarations
16490  __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
16491  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
16492 
16493  /* function exit code */
16494  __Pyx_RefNannyFinishContext();
16495  return __pyx_r;
16496 }
16497 
16498 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
16499  __Pyx_memviewslice *__pyx_v_mslice;
16500  __Pyx_memviewslice __pyx_v_tmp;
16501  PyObject *__pyx_r = NULL;
16502  __Pyx_TraceDeclarations
16503  __Pyx_RefNannyDeclarations
16504  __Pyx_memviewslice *__pyx_t_1;
16505  PyObject *__pyx_t_2 = NULL;
16506  int __pyx_lineno = 0;
16507  const char *__pyx_filename = NULL;
16508  int __pyx_clineno = 0;
16509  __Pyx_RefNannySetupContext("is_c_contig", 0);
16510  __Pyx_TraceCall("is_c_contig", __pyx_f[1], 621, 0, __PYX_ERR(1, 621, __pyx_L1_error));
16511 
16512  /* "View.MemoryView":624
16513  * cdef __Pyx_memviewslice *mslice
16514  * cdef __Pyx_memviewslice tmp
16515  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
16516  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
16517  *
16518  */
16519  __Pyx_TraceLine(624,0,__PYX_ERR(1, 624, __pyx_L1_error))
16520  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 624, __pyx_L1_error)
16521  __pyx_v_mslice = __pyx_t_1;
16522 
16523  /* "View.MemoryView":625
16524  * cdef __Pyx_memviewslice tmp
16525  * mslice = get_slice_from_memview(self, &tmp)
16526  * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
16527  *
16528  * def is_f_contig(self):
16529  */
16530  __Pyx_TraceLine(625,0,__PYX_ERR(1, 625, __pyx_L1_error))
16531  __Pyx_XDECREF(__pyx_r);
16532  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'C', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 625, __pyx_L1_error)
16533  __Pyx_GOTREF(__pyx_t_2);
16534  __pyx_r = __pyx_t_2;
16535  __pyx_t_2 = 0;
16536  goto __pyx_L0;
16537 
16538  /* "View.MemoryView":621
16539  *
16540  *
16541  * def is_c_contig(self): # <<<<<<<<<<<<<<
16542  * cdef __Pyx_memviewslice *mslice
16543  * cdef __Pyx_memviewslice tmp
16544  */
16545 
16546  /* function exit code */
16547  __pyx_L1_error:;
16548  __Pyx_XDECREF(__pyx_t_2);
16549  __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
16550  __pyx_r = NULL;
16551  __pyx_L0:;
16552  __Pyx_XGIVEREF(__pyx_r);
16553  __Pyx_TraceReturn(__pyx_r, 0);
16554  __Pyx_RefNannyFinishContext();
16555  return __pyx_r;
16556 }
16557 
16558 /* "View.MemoryView":627
16559  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
16560  *
16561  * def is_f_contig(self): # <<<<<<<<<<<<<<
16562  * cdef __Pyx_memviewslice *mslice
16563  * cdef __Pyx_memviewslice tmp
16564  */
16565 
16566 /* Python wrapper */
16567 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16568 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_19is_f_contig = {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0};
16569 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16570  PyObject *__pyx_r = 0;
16571  __Pyx_RefNannyDeclarations
16572  __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
16573  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
16574 
16575  /* function exit code */
16576  __Pyx_RefNannyFinishContext();
16577  return __pyx_r;
16578 }
16579 
16580 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
16581  __Pyx_memviewslice *__pyx_v_mslice;
16582  __Pyx_memviewslice __pyx_v_tmp;
16583  PyObject *__pyx_r = NULL;
16584  __Pyx_TraceDeclarations
16585  __Pyx_RefNannyDeclarations
16586  __Pyx_memviewslice *__pyx_t_1;
16587  PyObject *__pyx_t_2 = NULL;
16588  int __pyx_lineno = 0;
16589  const char *__pyx_filename = NULL;
16590  int __pyx_clineno = 0;
16591  __Pyx_RefNannySetupContext("is_f_contig", 0);
16592  __Pyx_TraceCall("is_f_contig", __pyx_f[1], 627, 0, __PYX_ERR(1, 627, __pyx_L1_error));
16593 
16594  /* "View.MemoryView":630
16595  * cdef __Pyx_memviewslice *mslice
16596  * cdef __Pyx_memviewslice tmp
16597  * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
16598  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
16599  *
16600  */
16601  __Pyx_TraceLine(630,0,__PYX_ERR(1, 630, __pyx_L1_error))
16602  __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp)); if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 630, __pyx_L1_error)
16603  __pyx_v_mslice = __pyx_t_1;
16604 
16605  /* "View.MemoryView":631
16606  * cdef __Pyx_memviewslice tmp
16607  * mslice = get_slice_from_memview(self, &tmp)
16608  * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
16609  *
16610  * def copy(self):
16611  */
16612  __Pyx_TraceLine(631,0,__PYX_ERR(1, 631, __pyx_L1_error))
16613  __Pyx_XDECREF(__pyx_r);
16614  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]), 'F', __pyx_v_self->view.ndim)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 631, __pyx_L1_error)
16615  __Pyx_GOTREF(__pyx_t_2);
16616  __pyx_r = __pyx_t_2;
16617  __pyx_t_2 = 0;
16618  goto __pyx_L0;
16619 
16620  /* "View.MemoryView":627
16621  * return slice_is_contig(mslice[0], 'C', self.view.ndim)
16622  *
16623  * def is_f_contig(self): # <<<<<<<<<<<<<<
16624  * cdef __Pyx_memviewslice *mslice
16625  * cdef __Pyx_memviewslice tmp
16626  */
16627 
16628  /* function exit code */
16629  __pyx_L1_error:;
16630  __Pyx_XDECREF(__pyx_t_2);
16631  __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
16632  __pyx_r = NULL;
16633  __pyx_L0:;
16634  __Pyx_XGIVEREF(__pyx_r);
16635  __Pyx_TraceReturn(__pyx_r, 0);
16636  __Pyx_RefNannyFinishContext();
16637  return __pyx_r;
16638 }
16639 
16640 /* "View.MemoryView":633
16641  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
16642  *
16643  * def copy(self): # <<<<<<<<<<<<<<
16644  * cdef __Pyx_memviewslice mslice
16645  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
16646  */
16647 
16648 /* Python wrapper */
16649 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16650 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_21copy = {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0};
16651 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16652  PyObject *__pyx_r = 0;
16653  __Pyx_RefNannyDeclarations
16654  __Pyx_RefNannySetupContext("copy (wrapper)", 0);
16655  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
16656 
16657  /* function exit code */
16658  __Pyx_RefNannyFinishContext();
16659  return __pyx_r;
16660 }
16661 
16662 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
16663  __Pyx_memviewslice __pyx_v_mslice;
16664  int __pyx_v_flags;
16665  PyObject *__pyx_r = NULL;
16666  __Pyx_TraceDeclarations
16667  __Pyx_RefNannyDeclarations
16668  __Pyx_memviewslice __pyx_t_1;
16669  PyObject *__pyx_t_2 = NULL;
16670  int __pyx_lineno = 0;
16671  const char *__pyx_filename = NULL;
16672  int __pyx_clineno = 0;
16673  __Pyx_RefNannySetupContext("copy", 0);
16674  __Pyx_TraceCall("copy", __pyx_f[1], 633, 0, __PYX_ERR(1, 633, __pyx_L1_error));
16675 
16676  /* "View.MemoryView":635
16677  * def copy(self):
16678  * cdef __Pyx_memviewslice mslice
16679  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
16680  *
16681  * slice_copy(self, &mslice)
16682  */
16683  __Pyx_TraceLine(635,0,__PYX_ERR(1, 635, __pyx_L1_error))
16684  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
16685 
16686  /* "View.MemoryView":637
16687  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
16688  *
16689  * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
16690  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
16691  * self.view.itemsize,
16692  */
16693  __Pyx_TraceLine(637,0,__PYX_ERR(1, 637, __pyx_L1_error))
16694  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
16695 
16696  /* "View.MemoryView":638
16697  *
16698  * slice_copy(self, &mslice)
16699  * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
16700  * self.view.itemsize,
16701  * flags|PyBUF_C_CONTIGUOUS,
16702  */
16703  __Pyx_TraceLine(638,0,__PYX_ERR(1, 638, __pyx_L1_error))
16704  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((char *)"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 638, __pyx_L1_error)
16705  __pyx_v_mslice = __pyx_t_1;
16706 
16707  /* "View.MemoryView":643
16708  * self.dtype_is_object)
16709  *
16710  * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
16711  *
16712  * def copy_fortran(self):
16713  */
16714  __Pyx_TraceLine(643,0,__PYX_ERR(1, 643, __pyx_L1_error))
16715  __Pyx_XDECREF(__pyx_r);
16716  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 643, __pyx_L1_error)
16717  __Pyx_GOTREF(__pyx_t_2);
16718  __pyx_r = __pyx_t_2;
16719  __pyx_t_2 = 0;
16720  goto __pyx_L0;
16721 
16722  /* "View.MemoryView":633
16723  * return slice_is_contig(mslice[0], 'F', self.view.ndim)
16724  *
16725  * def copy(self): # <<<<<<<<<<<<<<
16726  * cdef __Pyx_memviewslice mslice
16727  * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
16728  */
16729 
16730  /* function exit code */
16731  __pyx_L1_error:;
16732  __Pyx_XDECREF(__pyx_t_2);
16733  __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16734  __pyx_r = NULL;
16735  __pyx_L0:;
16736  __Pyx_XGIVEREF(__pyx_r);
16737  __Pyx_TraceReturn(__pyx_r, 0);
16738  __Pyx_RefNannyFinishContext();
16739  return __pyx_r;
16740 }
16741 
16742 /* "View.MemoryView":645
16743  * return memoryview_copy_from_slice(self, &mslice)
16744  *
16745  * def copy_fortran(self): # <<<<<<<<<<<<<<
16746  * cdef __Pyx_memviewslice src, dst
16747  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
16748  */
16749 
16750 /* Python wrapper */
16751 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16752 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_23copy_fortran = {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0};
16753 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16754  PyObject *__pyx_r = 0;
16755  __Pyx_RefNannyDeclarations
16756  __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
16757  __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
16758 
16759  /* function exit code */
16760  __Pyx_RefNannyFinishContext();
16761  return __pyx_r;
16762 }
16763 
16764 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
16765  __Pyx_memviewslice __pyx_v_src;
16766  __Pyx_memviewslice __pyx_v_dst;
16767  int __pyx_v_flags;
16768  PyObject *__pyx_r = NULL;
16769  __Pyx_TraceDeclarations
16770  __Pyx_RefNannyDeclarations
16771  __Pyx_memviewslice __pyx_t_1;
16772  PyObject *__pyx_t_2 = NULL;
16773  int __pyx_lineno = 0;
16774  const char *__pyx_filename = NULL;
16775  int __pyx_clineno = 0;
16776  __Pyx_RefNannySetupContext("copy_fortran", 0);
16777  __Pyx_TraceCall("copy_fortran", __pyx_f[1], 645, 0, __PYX_ERR(1, 645, __pyx_L1_error));
16778 
16779  /* "View.MemoryView":647
16780  * def copy_fortran(self):
16781  * cdef __Pyx_memviewslice src, dst
16782  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
16783  *
16784  * slice_copy(self, &src)
16785  */
16786  __Pyx_TraceLine(647,0,__PYX_ERR(1, 647, __pyx_L1_error))
16787  __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
16788 
16789  /* "View.MemoryView":649
16790  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
16791  *
16792  * slice_copy(self, &src) # <<<<<<<<<<<<<<
16793  * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
16794  * self.view.itemsize,
16795  */
16796  __Pyx_TraceLine(649,0,__PYX_ERR(1, 649, __pyx_L1_error))
16797  __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
16798 
16799  /* "View.MemoryView":650
16800  *
16801  * slice_copy(self, &src)
16802  * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
16803  * self.view.itemsize,
16804  * flags|PyBUF_F_CONTIGUOUS,
16805  */
16806  __Pyx_TraceLine(650,0,__PYX_ERR(1, 650, __pyx_L1_error))
16807  __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((char *)"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 650, __pyx_L1_error)
16808  __pyx_v_dst = __pyx_t_1;
16809 
16810  /* "View.MemoryView":655
16811  * self.dtype_is_object)
16812  *
16813  * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
16814  *
16815  *
16816  */
16817  __Pyx_TraceLine(655,0,__PYX_ERR(1, 655, __pyx_L1_error))
16818  __Pyx_XDECREF(__pyx_r);
16819  __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 655, __pyx_L1_error)
16820  __Pyx_GOTREF(__pyx_t_2);
16821  __pyx_r = __pyx_t_2;
16822  __pyx_t_2 = 0;
16823  goto __pyx_L0;
16824 
16825  /* "View.MemoryView":645
16826  * return memoryview_copy_from_slice(self, &mslice)
16827  *
16828  * def copy_fortran(self): # <<<<<<<<<<<<<<
16829  * cdef __Pyx_memviewslice src, dst
16830  * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
16831  */
16832 
16833  /* function exit code */
16834  __pyx_L1_error:;
16835  __Pyx_XDECREF(__pyx_t_2);
16836  __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
16837  __pyx_r = NULL;
16838  __pyx_L0:;
16839  __Pyx_XGIVEREF(__pyx_r);
16840  __Pyx_TraceReturn(__pyx_r, 0);
16841  __Pyx_RefNannyFinishContext();
16842  return __pyx_r;
16843 }
16844 
16845 /* "(tree fragment)":1
16846  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
16847  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16848  * def __setstate_cython__(self, __pyx_state):
16849  */
16850 
16851 /* Python wrapper */
16852 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
16853 static PyMethodDef __pyx_mdef___pyx_memoryview_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0};
16854 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16855  PyObject *__pyx_r = 0;
16856  __Pyx_RefNannyDeclarations
16857  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
16858  __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
16859 
16860  /* function exit code */
16861  __Pyx_RefNannyFinishContext();
16862  return __pyx_r;
16863 }
16864 
16865 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
16866  PyObject *__pyx_r = NULL;
16867  __Pyx_TraceDeclarations
16868  __Pyx_RefNannyDeclarations
16869  PyObject *__pyx_t_1 = NULL;
16870  int __pyx_lineno = 0;
16871  const char *__pyx_filename = NULL;
16872  int __pyx_clineno = 0;
16873  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
16874  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
16875 
16876  /* "(tree fragment)":2
16877  * def __reduce_cython__(self):
16878  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16879  * def __setstate_cython__(self, __pyx_state):
16880  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16881  */
16882  __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
16883  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
16884  __Pyx_GOTREF(__pyx_t_1);
16885  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16886  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16887  __PYX_ERR(1, 2, __pyx_L1_error)
16888 
16889  /* "(tree fragment)":1
16890  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
16891  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16892  * def __setstate_cython__(self, __pyx_state):
16893  */
16894 
16895  /* function exit code */
16896  __pyx_L1_error:;
16897  __Pyx_XDECREF(__pyx_t_1);
16898  __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16899  __pyx_r = NULL;
16900  __Pyx_XGIVEREF(__pyx_r);
16901  __Pyx_TraceReturn(__pyx_r, 0);
16902  __Pyx_RefNannyFinishContext();
16903  return __pyx_r;
16904 }
16905 
16906 /* "(tree fragment)":3
16907  * def __reduce_cython__(self):
16908  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16909  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
16910  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16911  */
16912 
16913 /* Python wrapper */
16914 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
16915 static PyMethodDef __pyx_mdef___pyx_memoryview_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0};
16916 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16917  PyObject *__pyx_r = 0;
16918  __Pyx_RefNannyDeclarations
16919  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
16920  __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16921 
16922  /* function exit code */
16923  __Pyx_RefNannyFinishContext();
16924  return __pyx_r;
16925 }
16926 
16927 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16928  PyObject *__pyx_r = NULL;
16929  __Pyx_TraceDeclarations
16930  __Pyx_RefNannyDeclarations
16931  PyObject *__pyx_t_1 = NULL;
16932  int __pyx_lineno = 0;
16933  const char *__pyx_filename = NULL;
16934  int __pyx_clineno = 0;
16935  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
16936  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
16937 
16938  /* "(tree fragment)":4
16939  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16940  * def __setstate_cython__(self, __pyx_state):
16941  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
16942  */
16943  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
16944  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
16945  __Pyx_GOTREF(__pyx_t_1);
16946  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16947  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16948  __PYX_ERR(1, 4, __pyx_L1_error)
16949 
16950  /* "(tree fragment)":3
16951  * def __reduce_cython__(self):
16952  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16953  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
16954  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
16955  */
16956 
16957  /* function exit code */
16958  __pyx_L1_error:;
16959  __Pyx_XDECREF(__pyx_t_1);
16960  __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16961  __pyx_r = NULL;
16962  __Pyx_XGIVEREF(__pyx_r);
16963  __Pyx_TraceReturn(__pyx_r, 0);
16964  __Pyx_RefNannyFinishContext();
16965  return __pyx_r;
16966 }
16967 
16968 /* "View.MemoryView":659
16969  *
16970  * @cname('__pyx_memoryview_new')
16971  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
16972  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
16973  * result.typeinfo = typeinfo
16974  */
16975 
16976 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
16977  struct __pyx_memoryview_obj *__pyx_v_result = 0;
16978  PyObject *__pyx_r = NULL;
16979  __Pyx_TraceDeclarations
16980  __Pyx_RefNannyDeclarations
16981  PyObject *__pyx_t_1 = NULL;
16982  PyObject *__pyx_t_2 = NULL;
16983  PyObject *__pyx_t_3 = NULL;
16984  int __pyx_lineno = 0;
16985  const char *__pyx_filename = NULL;
16986  int __pyx_clineno = 0;
16987  __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
16988  __Pyx_TraceCall("memoryview_cwrapper", __pyx_f[1], 659, 0, __PYX_ERR(1, 659, __pyx_L1_error));
16989 
16990  /* "View.MemoryView":660
16991  * @cname('__pyx_memoryview_new')
16992  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
16993  * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
16994  * result.typeinfo = typeinfo
16995  * return result
16996  */
16997  __Pyx_TraceLine(660,0,__PYX_ERR(1, 660, __pyx_L1_error))
16998  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 660, __pyx_L1_error)
16999  __Pyx_GOTREF(__pyx_t_1);
17000  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
17001  __Pyx_GOTREF(__pyx_t_2);
17002  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 660, __pyx_L1_error)
17003  __Pyx_GOTREF(__pyx_t_3);
17004  __Pyx_INCREF(__pyx_v_o);
17005  __Pyx_GIVEREF(__pyx_v_o);
17006  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
17007  __Pyx_GIVEREF(__pyx_t_1);
17008  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
17009  __Pyx_GIVEREF(__pyx_t_2);
17010  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17011  __pyx_t_1 = 0;
17012  __pyx_t_2 = 0;
17013  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 660, __pyx_L1_error)
17014  __Pyx_GOTREF(__pyx_t_2);
17015  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17016  __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
17017  __pyx_t_2 = 0;
17018 
17019  /* "View.MemoryView":661
17020  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
17021  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
17022  * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
17023  * return result
17024  *
17025  */
17026  __Pyx_TraceLine(661,0,__PYX_ERR(1, 661, __pyx_L1_error))
17027  __pyx_v_result->typeinfo = __pyx_v_typeinfo;
17028 
17029  /* "View.MemoryView":662
17030  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
17031  * result.typeinfo = typeinfo
17032  * return result # <<<<<<<<<<<<<<
17033  *
17034  * @cname('__pyx_memoryview_check')
17035  */
17036  __Pyx_TraceLine(662,0,__PYX_ERR(1, 662, __pyx_L1_error))
17037  __Pyx_XDECREF(__pyx_r);
17038  __Pyx_INCREF(((PyObject *)__pyx_v_result));
17039  __pyx_r = ((PyObject *)__pyx_v_result);
17040  goto __pyx_L0;
17041 
17042  /* "View.MemoryView":659
17043  *
17044  * @cname('__pyx_memoryview_new')
17045  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
17046  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
17047  * result.typeinfo = typeinfo
17048  */
17049 
17050  /* function exit code */
17051  __pyx_L1_error:;
17052  __Pyx_XDECREF(__pyx_t_1);
17053  __Pyx_XDECREF(__pyx_t_2);
17054  __Pyx_XDECREF(__pyx_t_3);
17055  __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
17056  __pyx_r = 0;
17057  __pyx_L0:;
17058  __Pyx_XDECREF((PyObject *)__pyx_v_result);
17059  __Pyx_XGIVEREF(__pyx_r);
17060  __Pyx_TraceReturn(__pyx_r, 0);
17061  __Pyx_RefNannyFinishContext();
17062  return __pyx_r;
17063 }
17064 
17065 /* "View.MemoryView":665
17066  *
17067  * @cname('__pyx_memoryview_check')
17068  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
17069  * return isinstance(o, memoryview)
17070  *
17071  */
17072 
17073 static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
17074  int __pyx_r;
17075  __Pyx_TraceDeclarations
17076  __Pyx_RefNannyDeclarations
17077  int __pyx_t_1;
17078  int __pyx_lineno = 0;
17079  const char *__pyx_filename = NULL;
17080  int __pyx_clineno = 0;
17081  __Pyx_RefNannySetupContext("memoryview_check", 0);
17082  __Pyx_TraceCall("memoryview_check", __pyx_f[1], 665, 0, __PYX_ERR(1, 665, __pyx_L1_error));
17083 
17084  /* "View.MemoryView":666
17085  * @cname('__pyx_memoryview_check')
17086  * cdef inline bint memoryview_check(object o):
17087  * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
17088  *
17089  * cdef tuple _unellipsify(object index, int ndim):
17090  */
17091  __Pyx_TraceLine(666,0,__PYX_ERR(1, 666, __pyx_L1_error))
17092  __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
17093  __pyx_r = __pyx_t_1;
17094  goto __pyx_L0;
17095 
17096  /* "View.MemoryView":665
17097  *
17098  * @cname('__pyx_memoryview_check')
17099  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
17100  * return isinstance(o, memoryview)
17101  *
17102  */
17103 
17104  /* function exit code */
17105  __pyx_L1_error:;
17106  __Pyx_WriteUnraisable("View.MemoryView.memoryview_check", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
17107  __pyx_r = 0;
17108  __pyx_L0:;
17109  __Pyx_TraceReturn(Py_None, 0);
17110  __Pyx_RefNannyFinishContext();
17111  return __pyx_r;
17112 }
17113 
17114 /* "View.MemoryView":668
17115  * return isinstance(o, memoryview)
17116  *
17117  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
17118  * """
17119  * Replace all ellipses with full slices and fill incomplete indices with
17120  */
17121 
17122 static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
17123  PyObject *__pyx_v_tup = NULL;
17124  PyObject *__pyx_v_result = NULL;
17125  int __pyx_v_have_slices;
17126  int __pyx_v_seen_ellipsis;
17127  CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
17128  PyObject *__pyx_v_item = NULL;
17129  Py_ssize_t __pyx_v_nslices;
17130  PyObject *__pyx_r = NULL;
17131  __Pyx_TraceDeclarations
17132  __Pyx_RefNannyDeclarations
17133  int __pyx_t_1;
17134  int __pyx_t_2;
17135  PyObject *__pyx_t_3 = NULL;
17136  PyObject *__pyx_t_4 = NULL;
17137  Py_ssize_t __pyx_t_5;
17138  PyObject *(*__pyx_t_6)(PyObject *);
17139  PyObject *__pyx_t_7 = NULL;
17140  Py_ssize_t __pyx_t_8;
17141  int __pyx_t_9;
17142  int __pyx_t_10;
17143  PyObject *__pyx_t_11 = NULL;
17144  int __pyx_lineno = 0;
17145  const char *__pyx_filename = NULL;
17146  int __pyx_clineno = 0;
17147  __Pyx_RefNannySetupContext("_unellipsify", 0);
17148  __Pyx_TraceCall("_unellipsify", __pyx_f[1], 668, 0, __PYX_ERR(1, 668, __pyx_L1_error));
17149 
17150  /* "View.MemoryView":673
17151  * full slices.
17152  * """
17153  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
17154  * tup = (index,)
17155  * else:
17156  */
17157  __Pyx_TraceLine(673,0,__PYX_ERR(1, 673, __pyx_L1_error))
17158  __pyx_t_1 = PyTuple_Check(__pyx_v_index);
17159  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
17160  if (__pyx_t_2) {
17161 
17162  /* "View.MemoryView":674
17163  * """
17164  * if not isinstance(index, tuple):
17165  * tup = (index,) # <<<<<<<<<<<<<<
17166  * else:
17167  * tup = index
17168  */
17169  __Pyx_TraceLine(674,0,__PYX_ERR(1, 674, __pyx_L1_error))
17170  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 674, __pyx_L1_error)
17171  __Pyx_GOTREF(__pyx_t_3);
17172  __Pyx_INCREF(__pyx_v_index);
17173  __Pyx_GIVEREF(__pyx_v_index);
17174  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
17175  __pyx_v_tup = __pyx_t_3;
17176  __pyx_t_3 = 0;
17177 
17178  /* "View.MemoryView":673
17179  * full slices.
17180  * """
17181  * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
17182  * tup = (index,)
17183  * else:
17184  */
17185  goto __pyx_L3;
17186  }
17187 
17188  /* "View.MemoryView":676
17189  * tup = (index,)
17190  * else:
17191  * tup = index # <<<<<<<<<<<<<<
17192  *
17193  * result = []
17194  */
17195  __Pyx_TraceLine(676,0,__PYX_ERR(1, 676, __pyx_L1_error))
17196  /*else*/ {
17197  __Pyx_INCREF(__pyx_v_index);
17198  __pyx_v_tup = __pyx_v_index;
17199  }
17200  __pyx_L3:;
17201 
17202  /* "View.MemoryView":678
17203  * tup = index
17204  *
17205  * result = [] # <<<<<<<<<<<<<<
17206  * have_slices = False
17207  * seen_ellipsis = False
17208  */
17209  __Pyx_TraceLine(678,0,__PYX_ERR(1, 678, __pyx_L1_error))
17210  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 678, __pyx_L1_error)
17211  __Pyx_GOTREF(__pyx_t_3);
17212  __pyx_v_result = ((PyObject*)__pyx_t_3);
17213  __pyx_t_3 = 0;
17214 
17215  /* "View.MemoryView":679
17216  *
17217  * result = []
17218  * have_slices = False # <<<<<<<<<<<<<<
17219  * seen_ellipsis = False
17220  * for idx, item in enumerate(tup):
17221  */
17222  __Pyx_TraceLine(679,0,__PYX_ERR(1, 679, __pyx_L1_error))
17223  __pyx_v_have_slices = 0;
17224 
17225  /* "View.MemoryView":680
17226  * result = []
17227  * have_slices = False
17228  * seen_ellipsis = False # <<<<<<<<<<<<<<
17229  * for idx, item in enumerate(tup):
17230  * if item is Ellipsis:
17231  */
17232  __Pyx_TraceLine(680,0,__PYX_ERR(1, 680, __pyx_L1_error))
17233  __pyx_v_seen_ellipsis = 0;
17234 
17235  /* "View.MemoryView":681
17236  * have_slices = False
17237  * seen_ellipsis = False
17238  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
17239  * if item is Ellipsis:
17240  * if not seen_ellipsis:
17241  */
17242  __Pyx_TraceLine(681,0,__PYX_ERR(1, 681, __pyx_L1_error))
17243  __Pyx_INCREF(__pyx_int_0);
17244  __pyx_t_3 = __pyx_int_0;
17245  if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
17246  __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
17247  __pyx_t_6 = NULL;
17248  } else {
17249  __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 681, __pyx_L1_error)
17250  __Pyx_GOTREF(__pyx_t_4);
17251  __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 681, __pyx_L1_error)
17252  }
17253  for (;;) {
17254  if (likely(!__pyx_t_6)) {
17255  if (likely(PyList_CheckExact(__pyx_t_4))) {
17256  if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
17257  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17258  __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error)
17259  #else
17260  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17261  __Pyx_GOTREF(__pyx_t_7);
17262  #endif
17263  } else {
17264  if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
17265  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17266  __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(1, 681, __pyx_L1_error)
17267  #else
17268  __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17269  __Pyx_GOTREF(__pyx_t_7);
17270  #endif
17271  }
17272  } else {
17273  __pyx_t_7 = __pyx_t_6(__pyx_t_4);
17274  if (unlikely(!__pyx_t_7)) {
17275  PyObject* exc_type = PyErr_Occurred();
17276  if (exc_type) {
17277  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
17278  else __PYX_ERR(1, 681, __pyx_L1_error)
17279  }
17280  break;
17281  }
17282  __Pyx_GOTREF(__pyx_t_7);
17283  }
17284  __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
17285  __pyx_t_7 = 0;
17286  __Pyx_INCREF(__pyx_t_3);
17287  __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
17288  __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 681, __pyx_L1_error)
17289  __Pyx_GOTREF(__pyx_t_7);
17290  __Pyx_DECREF(__pyx_t_3);
17291  __pyx_t_3 = __pyx_t_7;
17292  __pyx_t_7 = 0;
17293 
17294  /* "View.MemoryView":682
17295  * seen_ellipsis = False
17296  * for idx, item in enumerate(tup):
17297  * if item is Ellipsis: # <<<<<<<<<<<<<<
17298  * if not seen_ellipsis:
17299  * result.extend([slice(None)] * (ndim - len(tup) + 1))
17300  */
17301  __Pyx_TraceLine(682,0,__PYX_ERR(1, 682, __pyx_L1_error))
17302  __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
17303  __pyx_t_1 = (__pyx_t_2 != 0);
17304  if (__pyx_t_1) {
17305 
17306  /* "View.MemoryView":683
17307  * for idx, item in enumerate(tup):
17308  * if item is Ellipsis:
17309  * if not seen_ellipsis: # <<<<<<<<<<<<<<
17310  * result.extend([slice(None)] * (ndim - len(tup) + 1))
17311  * seen_ellipsis = True
17312  */
17313  __Pyx_TraceLine(683,0,__PYX_ERR(1, 683, __pyx_L1_error))
17314  __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
17315  if (__pyx_t_1) {
17316 
17317  /* "View.MemoryView":684
17318  * if item is Ellipsis:
17319  * if not seen_ellipsis:
17320  * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
17321  * seen_ellipsis = True
17322  * else:
17323  */
17324  __Pyx_TraceLine(684,0,__PYX_ERR(1, 684, __pyx_L1_error))
17325  __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 684, __pyx_L1_error)
17326  __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 684, __pyx_L1_error)
17327  __Pyx_GOTREF(__pyx_t_7);
17328  { Py_ssize_t __pyx_temp;
17329  for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
17330  __Pyx_INCREF(__pyx_slice__4);
17331  __Pyx_GIVEREF(__pyx_slice__4);
17332  PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__4);
17333  }
17334  }
17335  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 684, __pyx_L1_error)
17336  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17337 
17338  /* "View.MemoryView":685
17339  * if not seen_ellipsis:
17340  * result.extend([slice(None)] * (ndim - len(tup) + 1))
17341  * seen_ellipsis = True # <<<<<<<<<<<<<<
17342  * else:
17343  * result.append(slice(None))
17344  */
17345  __Pyx_TraceLine(685,0,__PYX_ERR(1, 685, __pyx_L1_error))
17346  __pyx_v_seen_ellipsis = 1;
17347 
17348  /* "View.MemoryView":683
17349  * for idx, item in enumerate(tup):
17350  * if item is Ellipsis:
17351  * if not seen_ellipsis: # <<<<<<<<<<<<<<
17352  * result.extend([slice(None)] * (ndim - len(tup) + 1))
17353  * seen_ellipsis = True
17354  */
17355  goto __pyx_L7;
17356  }
17357 
17358  /* "View.MemoryView":687
17359  * seen_ellipsis = True
17360  * else:
17361  * result.append(slice(None)) # <<<<<<<<<<<<<<
17362  * have_slices = True
17363  * else:
17364  */
17365  __Pyx_TraceLine(687,0,__PYX_ERR(1, 687, __pyx_L1_error))
17366  /*else*/ {
17367  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__4); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 687, __pyx_L1_error)
17368  }
17369  __pyx_L7:;
17370 
17371  /* "View.MemoryView":688
17372  * else:
17373  * result.append(slice(None))
17374  * have_slices = True # <<<<<<<<<<<<<<
17375  * else:
17376  * if not isinstance(item, slice) and not PyIndex_Check(item):
17377  */
17378  __Pyx_TraceLine(688,0,__PYX_ERR(1, 688, __pyx_L1_error))
17379  __pyx_v_have_slices = 1;
17380 
17381  /* "View.MemoryView":682
17382  * seen_ellipsis = False
17383  * for idx, item in enumerate(tup):
17384  * if item is Ellipsis: # <<<<<<<<<<<<<<
17385  * if not seen_ellipsis:
17386  * result.extend([slice(None)] * (ndim - len(tup) + 1))
17387  */
17388  goto __pyx_L6;
17389  }
17390 
17391  /* "View.MemoryView":690
17392  * have_slices = True
17393  * else:
17394  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
17395  * raise TypeError("Cannot index with type '%s'" % type(item))
17396  *
17397  */
17398  __Pyx_TraceLine(690,0,__PYX_ERR(1, 690, __pyx_L1_error))
17399  /*else*/ {
17400  __pyx_t_2 = PySlice_Check(__pyx_v_item);
17401  __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
17402  if (__pyx_t_10) {
17403  } else {
17404  __pyx_t_1 = __pyx_t_10;
17405  goto __pyx_L9_bool_binop_done;
17406  }
17407  __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
17408  __pyx_t_1 = __pyx_t_10;
17409  __pyx_L9_bool_binop_done:;
17410  if (unlikely(__pyx_t_1)) {
17411 
17412  /* "View.MemoryView":691
17413  * else:
17414  * if not isinstance(item, slice) and not PyIndex_Check(item):
17415  * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
17416  *
17417  * have_slices = have_slices or isinstance(item, slice)
17418  */
17419  __Pyx_TraceLine(691,0,__PYX_ERR(1, 691, __pyx_L1_error))
17420  __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item))); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 691, __pyx_L1_error)
17421  __Pyx_GOTREF(__pyx_t_7);
17422  __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 691, __pyx_L1_error)
17423  __Pyx_GOTREF(__pyx_t_11);
17424  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
17425  __Pyx_Raise(__pyx_t_11, 0, 0, 0);
17426  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
17427  __PYX_ERR(1, 691, __pyx_L1_error)
17428 
17429  /* "View.MemoryView":690
17430  * have_slices = True
17431  * else:
17432  * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
17433  * raise TypeError("Cannot index with type '%s'" % type(item))
17434  *
17435  */
17436  }
17437 
17438  /* "View.MemoryView":693
17439  * raise TypeError("Cannot index with type '%s'" % type(item))
17440  *
17441  * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
17442  * result.append(item)
17443  *
17444  */
17445  __Pyx_TraceLine(693,0,__PYX_ERR(1, 693, __pyx_L1_error))
17446  __pyx_t_10 = (__pyx_v_have_slices != 0);
17447  if (!__pyx_t_10) {
17448  } else {
17449  __pyx_t_1 = __pyx_t_10;
17450  goto __pyx_L11_bool_binop_done;
17451  }
17452  __pyx_t_10 = PySlice_Check(__pyx_v_item);
17453  __pyx_t_2 = (__pyx_t_10 != 0);
17454  __pyx_t_1 = __pyx_t_2;
17455  __pyx_L11_bool_binop_done:;
17456  __pyx_v_have_slices = __pyx_t_1;
17457 
17458  /* "View.MemoryView":694
17459  *
17460  * have_slices = have_slices or isinstance(item, slice)
17461  * result.append(item) # <<<<<<<<<<<<<<
17462  *
17463  * nslices = ndim - len(result)
17464  */
17465  __Pyx_TraceLine(694,0,__PYX_ERR(1, 694, __pyx_L1_error))
17466  __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
17467  }
17468  __pyx_L6:;
17469 
17470  /* "View.MemoryView":681
17471  * have_slices = False
17472  * seen_ellipsis = False
17473  * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
17474  * if item is Ellipsis:
17475  * if not seen_ellipsis:
17476  */
17477  __Pyx_TraceLine(681,0,__PYX_ERR(1, 681, __pyx_L1_error))
17478  }
17479  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
17480  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17481 
17482  /* "View.MemoryView":696
17483  * result.append(item)
17484  *
17485  * nslices = ndim - len(result) # <<<<<<<<<<<<<<
17486  * if nslices:
17487  * result.extend([slice(None)] * nslices)
17488  */
17489  __Pyx_TraceLine(696,0,__PYX_ERR(1, 696, __pyx_L1_error))
17490  __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
17491  __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
17492 
17493  /* "View.MemoryView":697
17494  *
17495  * nslices = ndim - len(result)
17496  * if nslices: # <<<<<<<<<<<<<<
17497  * result.extend([slice(None)] * nslices)
17498  *
17499  */
17500  __Pyx_TraceLine(697,0,__PYX_ERR(1, 697, __pyx_L1_error))
17501  __pyx_t_1 = (__pyx_v_nslices != 0);
17502  if (__pyx_t_1) {
17503 
17504  /* "View.MemoryView":698
17505  * nslices = ndim - len(result)
17506  * if nslices:
17507  * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
17508  *
17509  * return have_slices or nslices, tuple(result)
17510  */
17511  __Pyx_TraceLine(698,0,__PYX_ERR(1, 698, __pyx_L1_error))
17512  __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 698, __pyx_L1_error)
17513  __Pyx_GOTREF(__pyx_t_3);
17514  { Py_ssize_t __pyx_temp;
17515  for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
17516  __Pyx_INCREF(__pyx_slice__4);
17517  __Pyx_GIVEREF(__pyx_slice__4);
17518  PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__4);
17519  }
17520  }
17521  __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 698, __pyx_L1_error)
17522  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17523 
17524  /* "View.MemoryView":697
17525  *
17526  * nslices = ndim - len(result)
17527  * if nslices: # <<<<<<<<<<<<<<
17528  * result.extend([slice(None)] * nslices)
17529  *
17530  */
17531  }
17532 
17533  /* "View.MemoryView":700
17534  * result.extend([slice(None)] * nslices)
17535  *
17536  * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
17537  *
17538  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
17539  */
17540  __Pyx_TraceLine(700,0,__PYX_ERR(1, 700, __pyx_L1_error))
17541  __Pyx_XDECREF(__pyx_r);
17542  if (!__pyx_v_have_slices) {
17543  } else {
17544  __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17545  __Pyx_GOTREF(__pyx_t_4);
17546  __pyx_t_3 = __pyx_t_4;
17547  __pyx_t_4 = 0;
17548  goto __pyx_L14_bool_binop_done;
17549  }
17550  __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17551  __Pyx_GOTREF(__pyx_t_4);
17552  __pyx_t_3 = __pyx_t_4;
17553  __pyx_t_4 = 0;
17554  __pyx_L14_bool_binop_done:;
17555  __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 700, __pyx_L1_error)
17556  __Pyx_GOTREF(__pyx_t_4);
17557  __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 700, __pyx_L1_error)
17558  __Pyx_GOTREF(__pyx_t_11);
17559  __Pyx_GIVEREF(__pyx_t_3);
17560  PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
17561  __Pyx_GIVEREF(__pyx_t_4);
17562  PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
17563  __pyx_t_3 = 0;
17564  __pyx_t_4 = 0;
17565  __pyx_r = ((PyObject*)__pyx_t_11);
17566  __pyx_t_11 = 0;
17567  goto __pyx_L0;
17568 
17569  /* "View.MemoryView":668
17570  * return isinstance(o, memoryview)
17571  *
17572  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
17573  * """
17574  * Replace all ellipses with full slices and fill incomplete indices with
17575  */
17576 
17577  /* function exit code */
17578  __pyx_L1_error:;
17579  __Pyx_XDECREF(__pyx_t_3);
17580  __Pyx_XDECREF(__pyx_t_4);
17581  __Pyx_XDECREF(__pyx_t_7);
17582  __Pyx_XDECREF(__pyx_t_11);
17583  __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
17584  __pyx_r = 0;
17585  __pyx_L0:;
17586  __Pyx_XDECREF(__pyx_v_tup);
17587  __Pyx_XDECREF(__pyx_v_result);
17588  __Pyx_XDECREF(__pyx_v_idx);
17589  __Pyx_XDECREF(__pyx_v_item);
17590  __Pyx_XGIVEREF(__pyx_r);
17591  __Pyx_TraceReturn(__pyx_r, 0);
17592  __Pyx_RefNannyFinishContext();
17593  return __pyx_r;
17594 }
17595 
17596 /* "View.MemoryView":702
17597  * return have_slices or nslices, tuple(result)
17598  *
17599  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
17600  * for suboffset in suboffsets[:ndim]:
17601  * if suboffset >= 0:
17602  */
17603 
17604 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
17605  Py_ssize_t __pyx_v_suboffset;
17606  PyObject *__pyx_r = NULL;
17607  __Pyx_TraceDeclarations
17608  __Pyx_RefNannyDeclarations
17609  Py_ssize_t *__pyx_t_1;
17610  Py_ssize_t *__pyx_t_2;
17611  Py_ssize_t *__pyx_t_3;
17612  int __pyx_t_4;
17613  PyObject *__pyx_t_5 = NULL;
17614  int __pyx_lineno = 0;
17615  const char *__pyx_filename = NULL;
17616  int __pyx_clineno = 0;
17617  __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
17618  __Pyx_TraceCall("assert_direct_dimensions", __pyx_f[1], 702, 0, __PYX_ERR(1, 702, __pyx_L1_error));
17619 
17620  /* "View.MemoryView":703
17621  *
17622  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
17623  * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
17624  * if suboffset >= 0:
17625  * raise ValueError("Indirect dimensions not supported")
17626  */
17627  __Pyx_TraceLine(703,0,__PYX_ERR(1, 703, __pyx_L1_error))
17628  __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
17629  for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
17630  __pyx_t_1 = __pyx_t_3;
17631  __pyx_v_suboffset = (__pyx_t_1[0]);
17632 
17633  /* "View.MemoryView":704
17634  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
17635  * for suboffset in suboffsets[:ndim]:
17636  * if suboffset >= 0: # <<<<<<<<<<<<<<
17637  * raise ValueError("Indirect dimensions not supported")
17638  *
17639  */
17640  __Pyx_TraceLine(704,0,__PYX_ERR(1, 704, __pyx_L1_error))
17641  __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
17642  if (unlikely(__pyx_t_4)) {
17643 
17644  /* "View.MemoryView":705
17645  * for suboffset in suboffsets[:ndim]:
17646  * if suboffset >= 0:
17647  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
17648  *
17649  *
17650  */
17651  __Pyx_TraceLine(705,0,__PYX_ERR(1, 705, __pyx_L1_error))
17652  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 705, __pyx_L1_error)
17653  __Pyx_GOTREF(__pyx_t_5);
17654  __Pyx_Raise(__pyx_t_5, 0, 0, 0);
17655  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
17656  __PYX_ERR(1, 705, __pyx_L1_error)
17657 
17658  /* "View.MemoryView":704
17659  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
17660  * for suboffset in suboffsets[:ndim]:
17661  * if suboffset >= 0: # <<<<<<<<<<<<<<
17662  * raise ValueError("Indirect dimensions not supported")
17663  *
17664  */
17665  }
17666  }
17667 
17668  /* "View.MemoryView":702
17669  * return have_slices or nslices, tuple(result)
17670  *
17671  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
17672  * for suboffset in suboffsets[:ndim]:
17673  * if suboffset >= 0:
17674  */
17675 
17676  /* function exit code */
17677  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17678  goto __pyx_L0;
17679  __pyx_L1_error:;
17680  __Pyx_XDECREF(__pyx_t_5);
17681  __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
17682  __pyx_r = 0;
17683  __pyx_L0:;
17684  __Pyx_XGIVEREF(__pyx_r);
17685  __Pyx_TraceReturn(__pyx_r, 0);
17686  __Pyx_RefNannyFinishContext();
17687  return __pyx_r;
17688 }
17689 
17690 /* "View.MemoryView":712
17691  *
17692  * @cname('__pyx_memview_slice')
17693  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
17694  * cdef int new_ndim = 0, suboffset_dim = -1, dim
17695  * cdef bint negative_step
17696  */
17697 
17698 static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
17699  int __pyx_v_new_ndim;
17700  int __pyx_v_suboffset_dim;
17701  int __pyx_v_dim;
17702  __Pyx_memviewslice __pyx_v_src;
17703  __Pyx_memviewslice __pyx_v_dst;
17704  __Pyx_memviewslice *__pyx_v_p_src;
17705  struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
17706  __Pyx_memviewslice *__pyx_v_p_dst;
17707  int *__pyx_v_p_suboffset_dim;
17708  Py_ssize_t __pyx_v_start;
17709  Py_ssize_t __pyx_v_stop;
17710  Py_ssize_t __pyx_v_step;
17711  int __pyx_v_have_start;
17712  int __pyx_v_have_stop;
17713  int __pyx_v_have_step;
17714  PyObject *__pyx_v_index = NULL;
17715  struct __pyx_memoryview_obj *__pyx_r = NULL;
17716  __Pyx_TraceDeclarations
17717  __Pyx_RefNannyDeclarations
17718  int __pyx_t_1;
17719  int __pyx_t_2;
17720  PyObject *__pyx_t_3 = NULL;
17721  struct __pyx_memoryview_obj *__pyx_t_4;
17722  char *__pyx_t_5;
17723  int __pyx_t_6;
17724  Py_ssize_t __pyx_t_7;
17725  PyObject *(*__pyx_t_8)(PyObject *);
17726  PyObject *__pyx_t_9 = NULL;
17727  Py_ssize_t __pyx_t_10;
17728  int __pyx_t_11;
17729  Py_ssize_t __pyx_t_12;
17730  int __pyx_lineno = 0;
17731  const char *__pyx_filename = NULL;
17732  int __pyx_clineno = 0;
17733  __Pyx_RefNannySetupContext("memview_slice", 0);
17734  __Pyx_TraceCall("memview_slice", __pyx_f[1], 712, 0, __PYX_ERR(1, 712, __pyx_L1_error));
17735 
17736  /* "View.MemoryView":713
17737  * @cname('__pyx_memview_slice')
17738  * cdef memoryview memview_slice(memoryview memview, object indices):
17739  * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
17740  * cdef bint negative_step
17741  * cdef __Pyx_memviewslice src, dst
17742  */
17743  __Pyx_TraceLine(713,0,__PYX_ERR(1, 713, __pyx_L1_error))
17744  __pyx_v_new_ndim = 0;
17745  __pyx_v_suboffset_dim = -1;
17746 
17747  /* "View.MemoryView":720
17748  *
17749  *
17750  * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
17751  *
17752  * cdef _memoryviewslice memviewsliceobj
17753  */
17754  __Pyx_TraceLine(720,0,__PYX_ERR(1, 720, __pyx_L1_error))
17755  (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
17756 
17757  /* "View.MemoryView":724
17758  * cdef _memoryviewslice memviewsliceobj
17759  *
17760  * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
17761  *
17762  * if isinstance(memview, _memoryviewslice):
17763  */
17764  __Pyx_TraceLine(724,0,__PYX_ERR(1, 724, __pyx_L1_error))
17765  #ifndef CYTHON_WITHOUT_ASSERTIONS
17766  if (unlikely(__pyx_assertions_enabled())) {
17767  if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
17768  PyErr_SetNone(PyExc_AssertionError);
17769  __PYX_ERR(1, 724, __pyx_L1_error)
17770  }
17771  }
17772  #endif
17773 
17774  /* "View.MemoryView":726
17775  * assert memview.view.ndim > 0
17776  *
17777  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
17778  * memviewsliceobj = memview
17779  * p_src = &memviewsliceobj.from_slice
17780  */
17781  __Pyx_TraceLine(726,0,__PYX_ERR(1, 726, __pyx_L1_error))
17782  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17783  __pyx_t_2 = (__pyx_t_1 != 0);
17784  if (__pyx_t_2) {
17785 
17786  /* "View.MemoryView":727
17787  *
17788  * if isinstance(memview, _memoryviewslice):
17789  * memviewsliceobj = memview # <<<<<<<<<<<<<<
17790  * p_src = &memviewsliceobj.from_slice
17791  * else:
17792  */
17793  __Pyx_TraceLine(727,0,__PYX_ERR(1, 727, __pyx_L1_error))
17794  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 727, __pyx_L1_error)
17795  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
17796  __Pyx_INCREF(__pyx_t_3);
17797  __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
17798  __pyx_t_3 = 0;
17799 
17800  /* "View.MemoryView":728
17801  * if isinstance(memview, _memoryviewslice):
17802  * memviewsliceobj = memview
17803  * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
17804  * else:
17805  * slice_copy(memview, &src)
17806  */
17807  __Pyx_TraceLine(728,0,__PYX_ERR(1, 728, __pyx_L1_error))
17808  __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
17809 
17810  /* "View.MemoryView":726
17811  * assert memview.view.ndim > 0
17812  *
17813  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
17814  * memviewsliceobj = memview
17815  * p_src = &memviewsliceobj.from_slice
17816  */
17817  goto __pyx_L3;
17818  }
17819 
17820  /* "View.MemoryView":730
17821  * p_src = &memviewsliceobj.from_slice
17822  * else:
17823  * slice_copy(memview, &src) # <<<<<<<<<<<<<<
17824  * p_src = &src
17825  *
17826  */
17827  __Pyx_TraceLine(730,0,__PYX_ERR(1, 730, __pyx_L1_error))
17828  /*else*/ {
17829  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
17830 
17831  /* "View.MemoryView":731
17832  * else:
17833  * slice_copy(memview, &src)
17834  * p_src = &src # <<<<<<<<<<<<<<
17835  *
17836  *
17837  */
17838  __Pyx_TraceLine(731,0,__PYX_ERR(1, 731, __pyx_L1_error))
17839  __pyx_v_p_src = (&__pyx_v_src);
17840  }
17841  __pyx_L3:;
17842 
17843  /* "View.MemoryView":737
17844  *
17845  *
17846  * dst.memview = p_src.memview # <<<<<<<<<<<<<<
17847  * dst.data = p_src.data
17848  *
17849  */
17850  __Pyx_TraceLine(737,0,__PYX_ERR(1, 737, __pyx_L1_error))
17851  __pyx_t_4 = __pyx_v_p_src->memview;
17852  __pyx_v_dst.memview = __pyx_t_4;
17853 
17854  /* "View.MemoryView":738
17855  *
17856  * dst.memview = p_src.memview
17857  * dst.data = p_src.data # <<<<<<<<<<<<<<
17858  *
17859  *
17860  */
17861  __Pyx_TraceLine(738,0,__PYX_ERR(1, 738, __pyx_L1_error))
17862  __pyx_t_5 = __pyx_v_p_src->data;
17863  __pyx_v_dst.data = __pyx_t_5;
17864 
17865  /* "View.MemoryView":743
17866  *
17867  *
17868  * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
17869  * cdef int *p_suboffset_dim = &suboffset_dim
17870  * cdef Py_ssize_t start, stop, step
17871  */
17872  __Pyx_TraceLine(743,0,__PYX_ERR(1, 743, __pyx_L1_error))
17873  __pyx_v_p_dst = (&__pyx_v_dst);
17874 
17875  /* "View.MemoryView":744
17876  *
17877  * cdef __Pyx_memviewslice *p_dst = &dst
17878  * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
17879  * cdef Py_ssize_t start, stop, step
17880  * cdef bint have_start, have_stop, have_step
17881  */
17882  __Pyx_TraceLine(744,0,__PYX_ERR(1, 744, __pyx_L1_error))
17883  __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
17884 
17885  /* "View.MemoryView":748
17886  * cdef bint have_start, have_stop, have_step
17887  *
17888  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
17889  * if PyIndex_Check(index):
17890  * slice_memviewslice(
17891  */
17892  __Pyx_TraceLine(748,0,__PYX_ERR(1, 748, __pyx_L1_error))
17893  __pyx_t_6 = 0;
17894  if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
17895  __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
17896  __pyx_t_8 = NULL;
17897  } else {
17898  __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 748, __pyx_L1_error)
17899  __Pyx_GOTREF(__pyx_t_3);
17900  __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 748, __pyx_L1_error)
17901  }
17902  for (;;) {
17903  if (likely(!__pyx_t_8)) {
17904  if (likely(PyList_CheckExact(__pyx_t_3))) {
17905  if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
17906  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17907  __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
17908  #else
17909  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 748, __pyx_L1_error)
17910  __Pyx_GOTREF(__pyx_t_9);
17911  #endif
17912  } else {
17913  if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
17914  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
17915  __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(1, 748, __pyx_L1_error)
17916  #else
17917  __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 748, __pyx_L1_error)
17918  __Pyx_GOTREF(__pyx_t_9);
17919  #endif
17920  }
17921  } else {
17922  __pyx_t_9 = __pyx_t_8(__pyx_t_3);
17923  if (unlikely(!__pyx_t_9)) {
17924  PyObject* exc_type = PyErr_Occurred();
17925  if (exc_type) {
17926  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
17927  else __PYX_ERR(1, 748, __pyx_L1_error)
17928  }
17929  break;
17930  }
17931  __Pyx_GOTREF(__pyx_t_9);
17932  }
17933  __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
17934  __pyx_t_9 = 0;
17935  __pyx_v_dim = __pyx_t_6;
17936  __pyx_t_6 = (__pyx_t_6 + 1);
17937 
17938  /* "View.MemoryView":749
17939  *
17940  * for dim, index in enumerate(indices):
17941  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
17942  * slice_memviewslice(
17943  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
17944  */
17945  __Pyx_TraceLine(749,0,__PYX_ERR(1, 749, __pyx_L1_error))
17946  __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
17947  if (__pyx_t_2) {
17948 
17949  /* "View.MemoryView":753
17950  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
17951  * dim, new_ndim, p_suboffset_dim,
17952  * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
17953  * 0, 0, 0, # have_{start,stop,step}
17954  * False)
17955  */
17956  __Pyx_TraceLine(753,0,__PYX_ERR(1, 753, __pyx_L1_error))
17957  __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 753, __pyx_L1_error)
17958 
17959  /* "View.MemoryView":750
17960  * for dim, index in enumerate(indices):
17961  * if PyIndex_Check(index):
17962  * slice_memviewslice( # <<<<<<<<<<<<<<
17963  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
17964  * dim, new_ndim, p_suboffset_dim,
17965  */
17966  __Pyx_TraceLine(750,0,__PYX_ERR(1, 750, __pyx_L1_error))
17967  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 750, __pyx_L1_error)
17968 
17969  /* "View.MemoryView":749
17970  *
17971  * for dim, index in enumerate(indices):
17972  * if PyIndex_Check(index): # <<<<<<<<<<<<<<
17973  * slice_memviewslice(
17974  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
17975  */
17976  goto __pyx_L6;
17977  }
17978 
17979  /* "View.MemoryView":756
17980  * 0, 0, 0, # have_{start,stop,step}
17981  * False)
17982  * elif index is None: # <<<<<<<<<<<<<<
17983  * p_dst.shape[new_ndim] = 1
17984  * p_dst.strides[new_ndim] = 0
17985  */
17986  __Pyx_TraceLine(756,0,__PYX_ERR(1, 756, __pyx_L1_error))
17987  __pyx_t_2 = (__pyx_v_index == Py_None);
17988  __pyx_t_1 = (__pyx_t_2 != 0);
17989  if (__pyx_t_1) {
17990 
17991  /* "View.MemoryView":757
17992  * False)
17993  * elif index is None:
17994  * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
17995  * p_dst.strides[new_ndim] = 0
17996  * p_dst.suboffsets[new_ndim] = -1
17997  */
17998  __Pyx_TraceLine(757,0,__PYX_ERR(1, 757, __pyx_L1_error))
17999  (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
18000 
18001  /* "View.MemoryView":758
18002  * elif index is None:
18003  * p_dst.shape[new_ndim] = 1
18004  * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
18005  * p_dst.suboffsets[new_ndim] = -1
18006  * new_ndim += 1
18007  */
18008  __Pyx_TraceLine(758,0,__PYX_ERR(1, 758, __pyx_L1_error))
18009  (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
18010 
18011  /* "View.MemoryView":759
18012  * p_dst.shape[new_ndim] = 1
18013  * p_dst.strides[new_ndim] = 0
18014  * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
18015  * new_ndim += 1
18016  * else:
18017  */
18018  __Pyx_TraceLine(759,0,__PYX_ERR(1, 759, __pyx_L1_error))
18019  (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
18020 
18021  /* "View.MemoryView":760
18022  * p_dst.strides[new_ndim] = 0
18023  * p_dst.suboffsets[new_ndim] = -1
18024  * new_ndim += 1 # <<<<<<<<<<<<<<
18025  * else:
18026  * start = index.start or 0
18027  */
18028  __Pyx_TraceLine(760,0,__PYX_ERR(1, 760, __pyx_L1_error))
18029  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
18030 
18031  /* "View.MemoryView":756
18032  * 0, 0, 0, # have_{start,stop,step}
18033  * False)
18034  * elif index is None: # <<<<<<<<<<<<<<
18035  * p_dst.shape[new_ndim] = 1
18036  * p_dst.strides[new_ndim] = 0
18037  */
18038  goto __pyx_L6;
18039  }
18040 
18041  /* "View.MemoryView":762
18042  * new_ndim += 1
18043  * else:
18044  * start = index.start or 0 # <<<<<<<<<<<<<<
18045  * stop = index.stop or 0
18046  * step = index.step or 0
18047  */
18048  __Pyx_TraceLine(762,0,__PYX_ERR(1, 762, __pyx_L1_error))
18049  /*else*/ {
18050  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
18051  __Pyx_GOTREF(__pyx_t_9);
18052  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
18053  if (!__pyx_t_1) {
18054  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18055  } else {
18056  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
18057  __pyx_t_10 = __pyx_t_12;
18058  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18059  goto __pyx_L7_bool_binop_done;
18060  }
18061  __pyx_t_10 = 0;
18062  __pyx_L7_bool_binop_done:;
18063  __pyx_v_start = __pyx_t_10;
18064 
18065  /* "View.MemoryView":763
18066  * else:
18067  * start = index.start or 0
18068  * stop = index.stop or 0 # <<<<<<<<<<<<<<
18069  * step = index.step or 0
18070  *
18071  */
18072  __Pyx_TraceLine(763,0,__PYX_ERR(1, 763, __pyx_L1_error))
18073  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 763, __pyx_L1_error)
18074  __Pyx_GOTREF(__pyx_t_9);
18075  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 763, __pyx_L1_error)
18076  if (!__pyx_t_1) {
18077  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18078  } else {
18079  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 763, __pyx_L1_error)
18080  __pyx_t_10 = __pyx_t_12;
18081  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18082  goto __pyx_L9_bool_binop_done;
18083  }
18084  __pyx_t_10 = 0;
18085  __pyx_L9_bool_binop_done:;
18086  __pyx_v_stop = __pyx_t_10;
18087 
18088  /* "View.MemoryView":764
18089  * start = index.start or 0
18090  * stop = index.stop or 0
18091  * step = index.step or 0 # <<<<<<<<<<<<<<
18092  *
18093  * have_start = index.start is not None
18094  */
18095  __Pyx_TraceLine(764,0,__PYX_ERR(1, 764, __pyx_L1_error))
18096  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
18097  __Pyx_GOTREF(__pyx_t_9);
18098  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 764, __pyx_L1_error)
18099  if (!__pyx_t_1) {
18100  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18101  } else {
18102  __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 764, __pyx_L1_error)
18103  __pyx_t_10 = __pyx_t_12;
18104  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18105  goto __pyx_L11_bool_binop_done;
18106  }
18107  __pyx_t_10 = 0;
18108  __pyx_L11_bool_binop_done:;
18109  __pyx_v_step = __pyx_t_10;
18110 
18111  /* "View.MemoryView":766
18112  * step = index.step or 0
18113  *
18114  * have_start = index.start is not None # <<<<<<<<<<<<<<
18115  * have_stop = index.stop is not None
18116  * have_step = index.step is not None
18117  */
18118  __Pyx_TraceLine(766,0,__PYX_ERR(1, 766, __pyx_L1_error))
18119  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
18120  __Pyx_GOTREF(__pyx_t_9);
18121  __pyx_t_1 = (__pyx_t_9 != Py_None);
18122  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18123  __pyx_v_have_start = __pyx_t_1;
18124 
18125  /* "View.MemoryView":767
18126  *
18127  * have_start = index.start is not None
18128  * have_stop = index.stop is not None # <<<<<<<<<<<<<<
18129  * have_step = index.step is not None
18130  *
18131  */
18132  __Pyx_TraceLine(767,0,__PYX_ERR(1, 767, __pyx_L1_error))
18133  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 767, __pyx_L1_error)
18134  __Pyx_GOTREF(__pyx_t_9);
18135  __pyx_t_1 = (__pyx_t_9 != Py_None);
18136  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18137  __pyx_v_have_stop = __pyx_t_1;
18138 
18139  /* "View.MemoryView":768
18140  * have_start = index.start is not None
18141  * have_stop = index.stop is not None
18142  * have_step = index.step is not None # <<<<<<<<<<<<<<
18143  *
18144  * slice_memviewslice(
18145  */
18146  __Pyx_TraceLine(768,0,__PYX_ERR(1, 768, __pyx_L1_error))
18147  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 768, __pyx_L1_error)
18148  __Pyx_GOTREF(__pyx_t_9);
18149  __pyx_t_1 = (__pyx_t_9 != Py_None);
18150  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
18151  __pyx_v_have_step = __pyx_t_1;
18152 
18153  /* "View.MemoryView":770
18154  * have_step = index.step is not None
18155  *
18156  * slice_memviewslice( # <<<<<<<<<<<<<<
18157  * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
18158  * dim, new_ndim, p_suboffset_dim,
18159  */
18160  __Pyx_TraceLine(770,0,__PYX_ERR(1, 770, __pyx_L1_error))
18161  __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(1, 770, __pyx_L1_error)
18162 
18163  /* "View.MemoryView":776
18164  * have_start, have_stop, have_step,
18165  * True)
18166  * new_ndim += 1 # <<<<<<<<<<<<<<
18167  *
18168  * if isinstance(memview, _memoryviewslice):
18169  */
18170  __Pyx_TraceLine(776,0,__PYX_ERR(1, 776, __pyx_L1_error))
18171  __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
18172  }
18173  __pyx_L6:;
18174 
18175  /* "View.MemoryView":748
18176  * cdef bint have_start, have_stop, have_step
18177  *
18178  * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
18179  * if PyIndex_Check(index):
18180  * slice_memviewslice(
18181  */
18182  __Pyx_TraceLine(748,0,__PYX_ERR(1, 748, __pyx_L1_error))
18183  }
18184  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18185 
18186  /* "View.MemoryView":778
18187  * new_ndim += 1
18188  *
18189  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18190  * return memoryview_fromslice(dst, new_ndim,
18191  * memviewsliceobj.to_object_func,
18192  */
18193  __Pyx_TraceLine(778,0,__PYX_ERR(1, 778, __pyx_L1_error))
18194  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18195  __pyx_t_2 = (__pyx_t_1 != 0);
18196  if (__pyx_t_2) {
18197 
18198  /* "View.MemoryView":779
18199  *
18200  * if isinstance(memview, _memoryviewslice):
18201  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
18202  * memviewsliceobj.to_object_func,
18203  * memviewsliceobj.to_dtype_func,
18204  */
18205  __Pyx_TraceLine(779,0,__PYX_ERR(1, 779, __pyx_L1_error))
18206  __Pyx_XDECREF(((PyObject *)__pyx_r));
18207 
18208  /* "View.MemoryView":780
18209  * if isinstance(memview, _memoryviewslice):
18210  * return memoryview_fromslice(dst, new_ndim,
18211  * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
18212  * memviewsliceobj.to_dtype_func,
18213  * memview.dtype_is_object)
18214  */
18215  __Pyx_TraceLine(780,0,__PYX_ERR(1, 780, __pyx_L1_error))
18216  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 780, __pyx_L1_error) }
18217 
18218  /* "View.MemoryView":781
18219  * return memoryview_fromslice(dst, new_ndim,
18220  * memviewsliceobj.to_object_func,
18221  * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
18222  * memview.dtype_is_object)
18223  * else:
18224  */
18225  __Pyx_TraceLine(781,0,__PYX_ERR(1, 781, __pyx_L1_error))
18226  if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(1, 781, __pyx_L1_error) }
18227 
18228  /* "View.MemoryView":779
18229  *
18230  * if isinstance(memview, _memoryviewslice):
18231  * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
18232  * memviewsliceobj.to_object_func,
18233  * memviewsliceobj.to_dtype_func,
18234  */
18235  __Pyx_TraceLine(779,0,__PYX_ERR(1, 779, __pyx_L1_error))
18236  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 779, __pyx_L1_error)
18237  __Pyx_GOTREF(__pyx_t_3);
18238  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 779, __pyx_L1_error)
18239  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
18240  __pyx_t_3 = 0;
18241  goto __pyx_L0;
18242 
18243  /* "View.MemoryView":778
18244  * new_ndim += 1
18245  *
18246  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
18247  * return memoryview_fromslice(dst, new_ndim,
18248  * memviewsliceobj.to_object_func,
18249  */
18250  }
18251 
18252  /* "View.MemoryView":784
18253  * memview.dtype_is_object)
18254  * else:
18255  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
18256  * memview.dtype_is_object)
18257  *
18258  */
18259  __Pyx_TraceLine(784,0,__PYX_ERR(1, 784, __pyx_L1_error))
18260  /*else*/ {
18261  __Pyx_XDECREF(((PyObject *)__pyx_r));
18262 
18263  /* "View.MemoryView":785
18264  * else:
18265  * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
18266  * memview.dtype_is_object) # <<<<<<<<<<<<<<
18267  *
18268  *
18269  */
18270  __Pyx_TraceLine(785,0,__PYX_ERR(1, 785, __pyx_L1_error))
18271  __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 784, __pyx_L1_error)
18272  __Pyx_GOTREF(__pyx_t_3);
18273 
18274  /* "View.MemoryView":784
18275  * memview.dtype_is_object)
18276  * else:
18277  * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
18278  * memview.dtype_is_object)
18279  *
18280  */
18281  __Pyx_TraceLine(784,0,__PYX_ERR(1, 784, __pyx_L1_error))
18282  if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 784, __pyx_L1_error)
18283  __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
18284  __pyx_t_3 = 0;
18285  goto __pyx_L0;
18286  }
18287 
18288  /* "View.MemoryView":712
18289  *
18290  * @cname('__pyx_memview_slice')
18291  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
18292  * cdef int new_ndim = 0, suboffset_dim = -1, dim
18293  * cdef bint negative_step
18294  */
18295 
18296  /* function exit code */
18297  __pyx_L1_error:;
18298  __Pyx_XDECREF(__pyx_t_3);
18299  __Pyx_XDECREF(__pyx_t_9);
18300  __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18301  __pyx_r = 0;
18302  __pyx_L0:;
18303  __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
18304  __Pyx_XDECREF(__pyx_v_index);
18305  __Pyx_XGIVEREF((PyObject *)__pyx_r);
18306  __Pyx_TraceReturn(__pyx_r, 0);
18307  __Pyx_RefNannyFinishContext();
18308  return __pyx_r;
18309 }
18310 
18311 /* "View.MemoryView":809
18312  *
18313  * @cname('__pyx_memoryview_slice_memviewslice')
18314  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
18315  * __Pyx_memviewslice *dst,
18316  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
18317  */
18318 
18319 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset, int __pyx_v_dim, int __pyx_v_new_ndim, int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step, int __pyx_v_have_start, int __pyx_v_have_stop, int __pyx_v_have_step, int __pyx_v_is_slice) {
18320  Py_ssize_t __pyx_v_new_shape;
18321  int __pyx_v_negative_step;
18322  int __pyx_r;
18323  __Pyx_TraceDeclarations
18324  int __pyx_t_1;
18325  int __pyx_t_2;
18326  int __pyx_t_3;
18327  int __pyx_lineno = 0;
18328  const char *__pyx_filename = NULL;
18329  int __pyx_clineno = 0;
18330  __Pyx_TraceCall("slice_memviewslice", __pyx_f[1], 809, 1, __PYX_ERR(1, 809, __pyx_L1_error));
18331 
18332  /* "View.MemoryView":829
18333  * cdef bint negative_step
18334  *
18335  * if not is_slice: # <<<<<<<<<<<<<<
18336  *
18337  * if start < 0:
18338  */
18339  __Pyx_TraceLine(829,1,__PYX_ERR(1, 829, __pyx_L1_error))
18340  __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
18341  if (__pyx_t_1) {
18342 
18343  /* "View.MemoryView":831
18344  * if not is_slice:
18345  *
18346  * if start < 0: # <<<<<<<<<<<<<<
18347  * start += shape
18348  * if not 0 <= start < shape:
18349  */
18350  __Pyx_TraceLine(831,1,__PYX_ERR(1, 831, __pyx_L1_error))
18351  __pyx_t_1 = ((__pyx_v_start < 0) != 0);
18352  if (__pyx_t_1) {
18353 
18354  /* "View.MemoryView":832
18355  *
18356  * if start < 0:
18357  * start += shape # <<<<<<<<<<<<<<
18358  * if not 0 <= start < shape:
18359  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
18360  */
18361  __Pyx_TraceLine(832,1,__PYX_ERR(1, 832, __pyx_L1_error))
18362  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
18363 
18364  /* "View.MemoryView":831
18365  * if not is_slice:
18366  *
18367  * if start < 0: # <<<<<<<<<<<<<<
18368  * start += shape
18369  * if not 0 <= start < shape:
18370  */
18371  }
18372 
18373  /* "View.MemoryView":833
18374  * if start < 0:
18375  * start += shape
18376  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
18377  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
18378  * else:
18379  */
18380  __Pyx_TraceLine(833,1,__PYX_ERR(1, 833, __pyx_L1_error))
18381  __pyx_t_1 = (0 <= __pyx_v_start);
18382  if (__pyx_t_1) {
18383  __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
18384  }
18385  __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
18386  if (__pyx_t_2) {
18387 
18388  /* "View.MemoryView":834
18389  * start += shape
18390  * if not 0 <= start < shape:
18391  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
18392  * else:
18393  *
18394  */
18395  __Pyx_TraceLine(834,1,__PYX_ERR(1, 834, __pyx_L1_error))
18396  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"Index out of bounds (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 834, __pyx_L1_error)
18397 
18398  /* "View.MemoryView":833
18399  * if start < 0:
18400  * start += shape
18401  * if not 0 <= start < shape: # <<<<<<<<<<<<<<
18402  * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
18403  * else:
18404  */
18405  }
18406 
18407  /* "View.MemoryView":829
18408  * cdef bint negative_step
18409  *
18410  * if not is_slice: # <<<<<<<<<<<<<<
18411  *
18412  * if start < 0:
18413  */
18414  goto __pyx_L3;
18415  }
18416 
18417  /* "View.MemoryView":837
18418  * else:
18419  *
18420  * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
18421  *
18422  * if have_step and step == 0:
18423  */
18424  __Pyx_TraceLine(837,1,__PYX_ERR(1, 837, __pyx_L1_error))
18425  /*else*/ {
18426  __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
18427  if (__pyx_t_1) {
18428  } else {
18429  __pyx_t_2 = __pyx_t_1;
18430  goto __pyx_L6_bool_binop_done;
18431  }
18432  __pyx_t_1 = ((__pyx_v_step < 0) != 0);
18433  __pyx_t_2 = __pyx_t_1;
18434  __pyx_L6_bool_binop_done:;
18435  __pyx_v_negative_step = __pyx_t_2;
18436 
18437  /* "View.MemoryView":839
18438  * negative_step = have_step != 0 and step < 0
18439  *
18440  * if have_step and step == 0: # <<<<<<<<<<<<<<
18441  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
18442  *
18443  */
18444  __Pyx_TraceLine(839,1,__PYX_ERR(1, 839, __pyx_L1_error))
18445  __pyx_t_1 = (__pyx_v_have_step != 0);
18446  if (__pyx_t_1) {
18447  } else {
18448  __pyx_t_2 = __pyx_t_1;
18449  goto __pyx_L9_bool_binop_done;
18450  }
18451  __pyx_t_1 = ((__pyx_v_step == 0) != 0);
18452  __pyx_t_2 = __pyx_t_1;
18453  __pyx_L9_bool_binop_done:;
18454  if (__pyx_t_2) {
18455 
18456  /* "View.MemoryView":840
18457  *
18458  * if have_step and step == 0:
18459  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
18460  *
18461  *
18462  */
18463  __Pyx_TraceLine(840,1,__PYX_ERR(1, 840, __pyx_L1_error))
18464  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Step may not be zero (axis %d)"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 840, __pyx_L1_error)
18465 
18466  /* "View.MemoryView":839
18467  * negative_step = have_step != 0 and step < 0
18468  *
18469  * if have_step and step == 0: # <<<<<<<<<<<<<<
18470  * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
18471  *
18472  */
18473  }
18474 
18475  /* "View.MemoryView":843
18476  *
18477  *
18478  * if have_start: # <<<<<<<<<<<<<<
18479  * if start < 0:
18480  * start += shape
18481  */
18482  __Pyx_TraceLine(843,1,__PYX_ERR(1, 843, __pyx_L1_error))
18483  __pyx_t_2 = (__pyx_v_have_start != 0);
18484  if (__pyx_t_2) {
18485 
18486  /* "View.MemoryView":844
18487  *
18488  * if have_start:
18489  * if start < 0: # <<<<<<<<<<<<<<
18490  * start += shape
18491  * if start < 0:
18492  */
18493  __Pyx_TraceLine(844,1,__PYX_ERR(1, 844, __pyx_L1_error))
18494  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
18495  if (__pyx_t_2) {
18496 
18497  /* "View.MemoryView":845
18498  * if have_start:
18499  * if start < 0:
18500  * start += shape # <<<<<<<<<<<<<<
18501  * if start < 0:
18502  * start = 0
18503  */
18504  __Pyx_TraceLine(845,1,__PYX_ERR(1, 845, __pyx_L1_error))
18505  __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
18506 
18507  /* "View.MemoryView":846
18508  * if start < 0:
18509  * start += shape
18510  * if start < 0: # <<<<<<<<<<<<<<
18511  * start = 0
18512  * elif start >= shape:
18513  */
18514  __Pyx_TraceLine(846,1,__PYX_ERR(1, 846, __pyx_L1_error))
18515  __pyx_t_2 = ((__pyx_v_start < 0) != 0);
18516  if (__pyx_t_2) {
18517 
18518  /* "View.MemoryView":847
18519  * start += shape
18520  * if start < 0:
18521  * start = 0 # <<<<<<<<<<<<<<
18522  * elif start >= shape:
18523  * if negative_step:
18524  */
18525  __Pyx_TraceLine(847,1,__PYX_ERR(1, 847, __pyx_L1_error))
18526  __pyx_v_start = 0;
18527 
18528  /* "View.MemoryView":846
18529  * if start < 0:
18530  * start += shape
18531  * if start < 0: # <<<<<<<<<<<<<<
18532  * start = 0
18533  * elif start >= shape:
18534  */
18535  }
18536 
18537  /* "View.MemoryView":844
18538  *
18539  * if have_start:
18540  * if start < 0: # <<<<<<<<<<<<<<
18541  * start += shape
18542  * if start < 0:
18543  */
18544  goto __pyx_L12;
18545  }
18546 
18547  /* "View.MemoryView":848
18548  * if start < 0:
18549  * start = 0
18550  * elif start >= shape: # <<<<<<<<<<<<<<
18551  * if negative_step:
18552  * start = shape - 1
18553  */
18554  __Pyx_TraceLine(848,1,__PYX_ERR(1, 848, __pyx_L1_error))
18555  __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
18556  if (__pyx_t_2) {
18557 
18558  /* "View.MemoryView":849
18559  * start = 0
18560  * elif start >= shape:
18561  * if negative_step: # <<<<<<<<<<<<<<
18562  * start = shape - 1
18563  * else:
18564  */
18565  __Pyx_TraceLine(849,1,__PYX_ERR(1, 849, __pyx_L1_error))
18566  __pyx_t_2 = (__pyx_v_negative_step != 0);
18567  if (__pyx_t_2) {
18568 
18569  /* "View.MemoryView":850
18570  * elif start >= shape:
18571  * if negative_step:
18572  * start = shape - 1 # <<<<<<<<<<<<<<
18573  * else:
18574  * start = shape
18575  */
18576  __Pyx_TraceLine(850,1,__PYX_ERR(1, 850, __pyx_L1_error))
18577  __pyx_v_start = (__pyx_v_shape - 1);
18578 
18579  /* "View.MemoryView":849
18580  * start = 0
18581  * elif start >= shape:
18582  * if negative_step: # <<<<<<<<<<<<<<
18583  * start = shape - 1
18584  * else:
18585  */
18586  goto __pyx_L14;
18587  }
18588 
18589  /* "View.MemoryView":852
18590  * start = shape - 1
18591  * else:
18592  * start = shape # <<<<<<<<<<<<<<
18593  * else:
18594  * if negative_step:
18595  */
18596  __Pyx_TraceLine(852,1,__PYX_ERR(1, 852, __pyx_L1_error))
18597  /*else*/ {
18598  __pyx_v_start = __pyx_v_shape;
18599  }
18600  __pyx_L14:;
18601 
18602  /* "View.MemoryView":848
18603  * if start < 0:
18604  * start = 0
18605  * elif start >= shape: # <<<<<<<<<<<<<<
18606  * if negative_step:
18607  * start = shape - 1
18608  */
18609  }
18610  __pyx_L12:;
18611 
18612  /* "View.MemoryView":843
18613  *
18614  *
18615  * if have_start: # <<<<<<<<<<<<<<
18616  * if start < 0:
18617  * start += shape
18618  */
18619  goto __pyx_L11;
18620  }
18621 
18622  /* "View.MemoryView":854
18623  * start = shape
18624  * else:
18625  * if negative_step: # <<<<<<<<<<<<<<
18626  * start = shape - 1
18627  * else:
18628  */
18629  __Pyx_TraceLine(854,1,__PYX_ERR(1, 854, __pyx_L1_error))
18630  /*else*/ {
18631  __pyx_t_2 = (__pyx_v_negative_step != 0);
18632  if (__pyx_t_2) {
18633 
18634  /* "View.MemoryView":855
18635  * else:
18636  * if negative_step:
18637  * start = shape - 1 # <<<<<<<<<<<<<<
18638  * else:
18639  * start = 0
18640  */
18641  __Pyx_TraceLine(855,1,__PYX_ERR(1, 855, __pyx_L1_error))
18642  __pyx_v_start = (__pyx_v_shape - 1);
18643 
18644  /* "View.MemoryView":854
18645  * start = shape
18646  * else:
18647  * if negative_step: # <<<<<<<<<<<<<<
18648  * start = shape - 1
18649  * else:
18650  */
18651  goto __pyx_L15;
18652  }
18653 
18654  /* "View.MemoryView":857
18655  * start = shape - 1
18656  * else:
18657  * start = 0 # <<<<<<<<<<<<<<
18658  *
18659  * if have_stop:
18660  */
18661  __Pyx_TraceLine(857,1,__PYX_ERR(1, 857, __pyx_L1_error))
18662  /*else*/ {
18663  __pyx_v_start = 0;
18664  }
18665  __pyx_L15:;
18666  }
18667  __pyx_L11:;
18668 
18669  /* "View.MemoryView":859
18670  * start = 0
18671  *
18672  * if have_stop: # <<<<<<<<<<<<<<
18673  * if stop < 0:
18674  * stop += shape
18675  */
18676  __Pyx_TraceLine(859,1,__PYX_ERR(1, 859, __pyx_L1_error))
18677  __pyx_t_2 = (__pyx_v_have_stop != 0);
18678  if (__pyx_t_2) {
18679 
18680  /* "View.MemoryView":860
18681  *
18682  * if have_stop:
18683  * if stop < 0: # <<<<<<<<<<<<<<
18684  * stop += shape
18685  * if stop < 0:
18686  */
18687  __Pyx_TraceLine(860,1,__PYX_ERR(1, 860, __pyx_L1_error))
18688  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
18689  if (__pyx_t_2) {
18690 
18691  /* "View.MemoryView":861
18692  * if have_stop:
18693  * if stop < 0:
18694  * stop += shape # <<<<<<<<<<<<<<
18695  * if stop < 0:
18696  * stop = 0
18697  */
18698  __Pyx_TraceLine(861,1,__PYX_ERR(1, 861, __pyx_L1_error))
18699  __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
18700 
18701  /* "View.MemoryView":862
18702  * if stop < 0:
18703  * stop += shape
18704  * if stop < 0: # <<<<<<<<<<<<<<
18705  * stop = 0
18706  * elif stop > shape:
18707  */
18708  __Pyx_TraceLine(862,1,__PYX_ERR(1, 862, __pyx_L1_error))
18709  __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
18710  if (__pyx_t_2) {
18711 
18712  /* "View.MemoryView":863
18713  * stop += shape
18714  * if stop < 0:
18715  * stop = 0 # <<<<<<<<<<<<<<
18716  * elif stop > shape:
18717  * stop = shape
18718  */
18719  __Pyx_TraceLine(863,1,__PYX_ERR(1, 863, __pyx_L1_error))
18720  __pyx_v_stop = 0;
18721 
18722  /* "View.MemoryView":862
18723  * if stop < 0:
18724  * stop += shape
18725  * if stop < 0: # <<<<<<<<<<<<<<
18726  * stop = 0
18727  * elif stop > shape:
18728  */
18729  }
18730 
18731  /* "View.MemoryView":860
18732  *
18733  * if have_stop:
18734  * if stop < 0: # <<<<<<<<<<<<<<
18735  * stop += shape
18736  * if stop < 0:
18737  */
18738  goto __pyx_L17;
18739  }
18740 
18741  /* "View.MemoryView":864
18742  * if stop < 0:
18743  * stop = 0
18744  * elif stop > shape: # <<<<<<<<<<<<<<
18745  * stop = shape
18746  * else:
18747  */
18748  __Pyx_TraceLine(864,1,__PYX_ERR(1, 864, __pyx_L1_error))
18749  __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
18750  if (__pyx_t_2) {
18751 
18752  /* "View.MemoryView":865
18753  * stop = 0
18754  * elif stop > shape:
18755  * stop = shape # <<<<<<<<<<<<<<
18756  * else:
18757  * if negative_step:
18758  */
18759  __Pyx_TraceLine(865,1,__PYX_ERR(1, 865, __pyx_L1_error))
18760  __pyx_v_stop = __pyx_v_shape;
18761 
18762  /* "View.MemoryView":864
18763  * if stop < 0:
18764  * stop = 0
18765  * elif stop > shape: # <<<<<<<<<<<<<<
18766  * stop = shape
18767  * else:
18768  */
18769  }
18770  __pyx_L17:;
18771 
18772  /* "View.MemoryView":859
18773  * start = 0
18774  *
18775  * if have_stop: # <<<<<<<<<<<<<<
18776  * if stop < 0:
18777  * stop += shape
18778  */
18779  goto __pyx_L16;
18780  }
18781 
18782  /* "View.MemoryView":867
18783  * stop = shape
18784  * else:
18785  * if negative_step: # <<<<<<<<<<<<<<
18786  * stop = -1
18787  * else:
18788  */
18789  __Pyx_TraceLine(867,1,__PYX_ERR(1, 867, __pyx_L1_error))
18790  /*else*/ {
18791  __pyx_t_2 = (__pyx_v_negative_step != 0);
18792  if (__pyx_t_2) {
18793 
18794  /* "View.MemoryView":868
18795  * else:
18796  * if negative_step:
18797  * stop = -1 # <<<<<<<<<<<<<<
18798  * else:
18799  * stop = shape
18800  */
18801  __Pyx_TraceLine(868,1,__PYX_ERR(1, 868, __pyx_L1_error))
18802  __pyx_v_stop = -1L;
18803 
18804  /* "View.MemoryView":867
18805  * stop = shape
18806  * else:
18807  * if negative_step: # <<<<<<<<<<<<<<
18808  * stop = -1
18809  * else:
18810  */
18811  goto __pyx_L19;
18812  }
18813 
18814  /* "View.MemoryView":870
18815  * stop = -1
18816  * else:
18817  * stop = shape # <<<<<<<<<<<<<<
18818  *
18819  * if not have_step:
18820  */
18821  __Pyx_TraceLine(870,1,__PYX_ERR(1, 870, __pyx_L1_error))
18822  /*else*/ {
18823  __pyx_v_stop = __pyx_v_shape;
18824  }
18825  __pyx_L19:;
18826  }
18827  __pyx_L16:;
18828 
18829  /* "View.MemoryView":872
18830  * stop = shape
18831  *
18832  * if not have_step: # <<<<<<<<<<<<<<
18833  * step = 1
18834  *
18835  */
18836  __Pyx_TraceLine(872,1,__PYX_ERR(1, 872, __pyx_L1_error))
18837  __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
18838  if (__pyx_t_2) {
18839 
18840  /* "View.MemoryView":873
18841  *
18842  * if not have_step:
18843  * step = 1 # <<<<<<<<<<<<<<
18844  *
18845  *
18846  */
18847  __Pyx_TraceLine(873,1,__PYX_ERR(1, 873, __pyx_L1_error))
18848  __pyx_v_step = 1;
18849 
18850  /* "View.MemoryView":872
18851  * stop = shape
18852  *
18853  * if not have_step: # <<<<<<<<<<<<<<
18854  * step = 1
18855  *
18856  */
18857  }
18858 
18859  /* "View.MemoryView":877
18860  *
18861  * with cython.cdivision(True):
18862  * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
18863  *
18864  * if (stop - start) - step * new_shape:
18865  */
18866  __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
18867 
18868  /* "View.MemoryView":879
18869  * new_shape = (stop - start) // step
18870  *
18871  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
18872  * new_shape += 1
18873  *
18874  */
18875  __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
18876  if (__pyx_t_2) {
18877 
18878  /* "View.MemoryView":880
18879  *
18880  * if (stop - start) - step * new_shape:
18881  * new_shape += 1 # <<<<<<<<<<<<<<
18882  *
18883  * if new_shape < 0:
18884  */
18885  __pyx_v_new_shape = (__pyx_v_new_shape + 1);
18886 
18887  /* "View.MemoryView":879
18888  * new_shape = (stop - start) // step
18889  *
18890  * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
18891  * new_shape += 1
18892  *
18893  */
18894  }
18895 
18896  /* "View.MemoryView":882
18897  * new_shape += 1
18898  *
18899  * if new_shape < 0: # <<<<<<<<<<<<<<
18900  * new_shape = 0
18901  *
18902  */
18903  __Pyx_TraceLine(882,1,__PYX_ERR(1, 882, __pyx_L1_error))
18904  __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
18905  if (__pyx_t_2) {
18906 
18907  /* "View.MemoryView":883
18908  *
18909  * if new_shape < 0:
18910  * new_shape = 0 # <<<<<<<<<<<<<<
18911  *
18912  *
18913  */
18914  __Pyx_TraceLine(883,1,__PYX_ERR(1, 883, __pyx_L1_error))
18915  __pyx_v_new_shape = 0;
18916 
18917  /* "View.MemoryView":882
18918  * new_shape += 1
18919  *
18920  * if new_shape < 0: # <<<<<<<<<<<<<<
18921  * new_shape = 0
18922  *
18923  */
18924  }
18925 
18926  /* "View.MemoryView":886
18927  *
18928  *
18929  * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
18930  * dst.shape[new_ndim] = new_shape
18931  * dst.suboffsets[new_ndim] = suboffset
18932  */
18933  __Pyx_TraceLine(886,1,__PYX_ERR(1, 886, __pyx_L1_error))
18934  (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
18935 
18936  /* "View.MemoryView":887
18937  *
18938  * dst.strides[new_ndim] = stride * step
18939  * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
18940  * dst.suboffsets[new_ndim] = suboffset
18941  *
18942  */
18943  __Pyx_TraceLine(887,1,__PYX_ERR(1, 887, __pyx_L1_error))
18944  (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
18945 
18946  /* "View.MemoryView":888
18947  * dst.strides[new_ndim] = stride * step
18948  * dst.shape[new_ndim] = new_shape
18949  * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
18950  *
18951  *
18952  */
18953  __Pyx_TraceLine(888,1,__PYX_ERR(1, 888, __pyx_L1_error))
18954  (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
18955  }
18956  __pyx_L3:;
18957 
18958  /* "View.MemoryView":891
18959  *
18960  *
18961  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
18962  * dst.data += start * stride
18963  * else:
18964  */
18965  __Pyx_TraceLine(891,1,__PYX_ERR(1, 891, __pyx_L1_error))
18966  __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
18967  if (__pyx_t_2) {
18968 
18969  /* "View.MemoryView":892
18970  *
18971  * if suboffset_dim[0] < 0:
18972  * dst.data += start * stride # <<<<<<<<<<<<<<
18973  * else:
18974  * dst.suboffsets[suboffset_dim[0]] += start * stride
18975  */
18976  __Pyx_TraceLine(892,1,__PYX_ERR(1, 892, __pyx_L1_error))
18977  __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
18978 
18979  /* "View.MemoryView":891
18980  *
18981  *
18982  * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
18983  * dst.data += start * stride
18984  * else:
18985  */
18986  goto __pyx_L23;
18987  }
18988 
18989  /* "View.MemoryView":894
18990  * dst.data += start * stride
18991  * else:
18992  * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
18993  *
18994  * if suboffset >= 0:
18995  */
18996  __Pyx_TraceLine(894,1,__PYX_ERR(1, 894, __pyx_L1_error))
18997  /*else*/ {
18998  __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
18999  (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
19000  }
19001  __pyx_L23:;
19002 
19003  /* "View.MemoryView":896
19004  * dst.suboffsets[suboffset_dim[0]] += start * stride
19005  *
19006  * if suboffset >= 0: # <<<<<<<<<<<<<<
19007  * if not is_slice:
19008  * if new_ndim == 0:
19009  */
19010  __Pyx_TraceLine(896,1,__PYX_ERR(1, 896, __pyx_L1_error))
19011  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
19012  if (__pyx_t_2) {
19013 
19014  /* "View.MemoryView":897
19015  *
19016  * if suboffset >= 0:
19017  * if not is_slice: # <<<<<<<<<<<<<<
19018  * if new_ndim == 0:
19019  * dst.data = (<char **> dst.data)[0] + suboffset
19020  */
19021  __Pyx_TraceLine(897,1,__PYX_ERR(1, 897, __pyx_L1_error))
19022  __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
19023  if (__pyx_t_2) {
19024 
19025  /* "View.MemoryView":898
19026  * if suboffset >= 0:
19027  * if not is_slice:
19028  * if new_ndim == 0: # <<<<<<<<<<<<<<
19029  * dst.data = (<char **> dst.data)[0] + suboffset
19030  * else:
19031  */
19032  __Pyx_TraceLine(898,1,__PYX_ERR(1, 898, __pyx_L1_error))
19033  __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
19034  if (__pyx_t_2) {
19035 
19036  /* "View.MemoryView":899
19037  * if not is_slice:
19038  * if new_ndim == 0:
19039  * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
19040  * else:
19041  * _err_dim(IndexError, "All dimensions preceding dimension %d "
19042  */
19043  __Pyx_TraceLine(899,1,__PYX_ERR(1, 899, __pyx_L1_error))
19044  __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
19045 
19046  /* "View.MemoryView":898
19047  * if suboffset >= 0:
19048  * if not is_slice:
19049  * if new_ndim == 0: # <<<<<<<<<<<<<<
19050  * dst.data = (<char **> dst.data)[0] + suboffset
19051  * else:
19052  */
19053  goto __pyx_L26;
19054  }
19055 
19056  /* "View.MemoryView":901
19057  * dst.data = (<char **> dst.data)[0] + suboffset
19058  * else:
19059  * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
19060  * "must be indexed and not sliced", dim)
19061  * else:
19062  */
19063  __Pyx_TraceLine(901,1,__PYX_ERR(1, 901, __pyx_L1_error))
19064  /*else*/ {
19065 
19066  /* "View.MemoryView":902
19067  * else:
19068  * _err_dim(IndexError, "All dimensions preceding dimension %d "
19069  * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
19070  * else:
19071  * suboffset_dim[0] = new_ndim
19072  */
19073  __Pyx_TraceLine(902,1,__PYX_ERR(1, 902, __pyx_L1_error))
19074  __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((char *)"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 901, __pyx_L1_error)
19075  }
19076  __pyx_L26:;
19077 
19078  /* "View.MemoryView":897
19079  *
19080  * if suboffset >= 0:
19081  * if not is_slice: # <<<<<<<<<<<<<<
19082  * if new_ndim == 0:
19083  * dst.data = (<char **> dst.data)[0] + suboffset
19084  */
19085  goto __pyx_L25;
19086  }
19087 
19088  /* "View.MemoryView":904
19089  * "must be indexed and not sliced", dim)
19090  * else:
19091  * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
19092  *
19093  * return 0
19094  */
19095  __Pyx_TraceLine(904,1,__PYX_ERR(1, 904, __pyx_L1_error))
19096  /*else*/ {
19097  (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
19098  }
19099  __pyx_L25:;
19100 
19101  /* "View.MemoryView":896
19102  * dst.suboffsets[suboffset_dim[0]] += start * stride
19103  *
19104  * if suboffset >= 0: # <<<<<<<<<<<<<<
19105  * if not is_slice:
19106  * if new_ndim == 0:
19107  */
19108  }
19109 
19110  /* "View.MemoryView":906
19111  * suboffset_dim[0] = new_ndim
19112  *
19113  * return 0 # <<<<<<<<<<<<<<
19114  *
19115  *
19116  */
19117  __Pyx_TraceLine(906,1,__PYX_ERR(1, 906, __pyx_L1_error))
19118  __pyx_r = 0;
19119  goto __pyx_L0;
19120 
19121  /* "View.MemoryView":809
19122  *
19123  * @cname('__pyx_memoryview_slice_memviewslice')
19124  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
19125  * __Pyx_memviewslice *dst,
19126  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
19127  */
19128 
19129  /* function exit code */
19130  __pyx_L1_error:;
19131  {
19132  #ifdef WITH_THREAD
19133  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19134  #endif
19135  __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
19136  #ifdef WITH_THREAD
19137  __Pyx_PyGILState_Release(__pyx_gilstate_save);
19138  #endif
19139  }
19140  __pyx_r = -1;
19141  __pyx_L0:;
19142  __Pyx_TraceReturn(Py_None, 1);
19143  return __pyx_r;
19144 }
19145 
19146 /* "View.MemoryView":912
19147  *
19148  * @cname('__pyx_pybuffer_index')
19149  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
19150  * Py_ssize_t dim) except NULL:
19151  * cdef Py_ssize_t shape, stride, suboffset = -1
19152  */
19153 
19154 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
19155  Py_ssize_t __pyx_v_shape;
19156  Py_ssize_t __pyx_v_stride;
19157  Py_ssize_t __pyx_v_suboffset;
19158  Py_ssize_t __pyx_v_itemsize;
19159  char *__pyx_v_resultp;
19160  char *__pyx_r;
19161  __Pyx_TraceDeclarations
19162  __Pyx_RefNannyDeclarations
19163  Py_ssize_t __pyx_t_1;
19164  int __pyx_t_2;
19165  PyObject *__pyx_t_3 = NULL;
19166  PyObject *__pyx_t_4 = NULL;
19167  int __pyx_lineno = 0;
19168  const char *__pyx_filename = NULL;
19169  int __pyx_clineno = 0;
19170  __Pyx_RefNannySetupContext("pybuffer_index", 0);
19171  __Pyx_TraceCall("pybuffer_index", __pyx_f[1], 912, 0, __PYX_ERR(1, 912, __pyx_L1_error));
19172 
19173  /* "View.MemoryView":914
19174  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
19175  * Py_ssize_t dim) except NULL:
19176  * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
19177  * cdef Py_ssize_t itemsize = view.itemsize
19178  * cdef char *resultp
19179  */
19180  __Pyx_TraceLine(914,0,__PYX_ERR(1, 914, __pyx_L1_error))
19181  __pyx_v_suboffset = -1L;
19182 
19183  /* "View.MemoryView":915
19184  * Py_ssize_t dim) except NULL:
19185  * cdef Py_ssize_t shape, stride, suboffset = -1
19186  * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
19187  * cdef char *resultp
19188  *
19189  */
19190  __Pyx_TraceLine(915,0,__PYX_ERR(1, 915, __pyx_L1_error))
19191  __pyx_t_1 = __pyx_v_view->itemsize;
19192  __pyx_v_itemsize = __pyx_t_1;
19193 
19194  /* "View.MemoryView":918
19195  * cdef char *resultp
19196  *
19197  * if view.ndim == 0: # <<<<<<<<<<<<<<
19198  * shape = view.len / itemsize
19199  * stride = itemsize
19200  */
19201  __Pyx_TraceLine(918,0,__PYX_ERR(1, 918, __pyx_L1_error))
19202  __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
19203  if (__pyx_t_2) {
19204 
19205  /* "View.MemoryView":919
19206  *
19207  * if view.ndim == 0:
19208  * shape = view.len / itemsize # <<<<<<<<<<<<<<
19209  * stride = itemsize
19210  * else:
19211  */
19212  __Pyx_TraceLine(919,0,__PYX_ERR(1, 919, __pyx_L1_error))
19213  if (unlikely(__pyx_v_itemsize == 0)) {
19214  PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
19215  __PYX_ERR(1, 919, __pyx_L1_error)
19216  }
19217  else if (sizeof(Py_ssize_t) == sizeof(long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
19218  PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
19219  __PYX_ERR(1, 919, __pyx_L1_error)
19220  }
19221  __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
19222 
19223  /* "View.MemoryView":920
19224  * if view.ndim == 0:
19225  * shape = view.len / itemsize
19226  * stride = itemsize # <<<<<<<<<<<<<<
19227  * else:
19228  * shape = view.shape[dim]
19229  */
19230  __Pyx_TraceLine(920,0,__PYX_ERR(1, 920, __pyx_L1_error))
19231  __pyx_v_stride = __pyx_v_itemsize;
19232 
19233  /* "View.MemoryView":918
19234  * cdef char *resultp
19235  *
19236  * if view.ndim == 0: # <<<<<<<<<<<<<<
19237  * shape = view.len / itemsize
19238  * stride = itemsize
19239  */
19240  goto __pyx_L3;
19241  }
19242 
19243  /* "View.MemoryView":922
19244  * stride = itemsize
19245  * else:
19246  * shape = view.shape[dim] # <<<<<<<<<<<<<<
19247  * stride = view.strides[dim]
19248  * if view.suboffsets != NULL:
19249  */
19250  __Pyx_TraceLine(922,0,__PYX_ERR(1, 922, __pyx_L1_error))
19251  /*else*/ {
19252  __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
19253 
19254  /* "View.MemoryView":923
19255  * else:
19256  * shape = view.shape[dim]
19257  * stride = view.strides[dim] # <<<<<<<<<<<<<<
19258  * if view.suboffsets != NULL:
19259  * suboffset = view.suboffsets[dim]
19260  */
19261  __Pyx_TraceLine(923,0,__PYX_ERR(1, 923, __pyx_L1_error))
19262  __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
19263 
19264  /* "View.MemoryView":924
19265  * shape = view.shape[dim]
19266  * stride = view.strides[dim]
19267  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
19268  * suboffset = view.suboffsets[dim]
19269  *
19270  */
19271  __Pyx_TraceLine(924,0,__PYX_ERR(1, 924, __pyx_L1_error))
19272  __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
19273  if (__pyx_t_2) {
19274 
19275  /* "View.MemoryView":925
19276  * stride = view.strides[dim]
19277  * if view.suboffsets != NULL:
19278  * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
19279  *
19280  * if index < 0:
19281  */
19282  __Pyx_TraceLine(925,0,__PYX_ERR(1, 925, __pyx_L1_error))
19283  __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
19284 
19285  /* "View.MemoryView":924
19286  * shape = view.shape[dim]
19287  * stride = view.strides[dim]
19288  * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
19289  * suboffset = view.suboffsets[dim]
19290  *
19291  */
19292  }
19293  }
19294  __pyx_L3:;
19295 
19296  /* "View.MemoryView":927
19297  * suboffset = view.suboffsets[dim]
19298  *
19299  * if index < 0: # <<<<<<<<<<<<<<
19300  * index += view.shape[dim]
19301  * if index < 0:
19302  */
19303  __Pyx_TraceLine(927,0,__PYX_ERR(1, 927, __pyx_L1_error))
19304  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
19305  if (__pyx_t_2) {
19306 
19307  /* "View.MemoryView":928
19308  *
19309  * if index < 0:
19310  * index += view.shape[dim] # <<<<<<<<<<<<<<
19311  * if index < 0:
19312  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19313  */
19314  __Pyx_TraceLine(928,0,__PYX_ERR(1, 928, __pyx_L1_error))
19315  __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
19316 
19317  /* "View.MemoryView":929
19318  * if index < 0:
19319  * index += view.shape[dim]
19320  * if index < 0: # <<<<<<<<<<<<<<
19321  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19322  *
19323  */
19324  __Pyx_TraceLine(929,0,__PYX_ERR(1, 929, __pyx_L1_error))
19325  __pyx_t_2 = ((__pyx_v_index < 0) != 0);
19326  if (unlikely(__pyx_t_2)) {
19327 
19328  /* "View.MemoryView":930
19329  * index += view.shape[dim]
19330  * if index < 0:
19331  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
19332  *
19333  * if index >= shape:
19334  */
19335  __Pyx_TraceLine(930,0,__PYX_ERR(1, 930, __pyx_L1_error))
19336  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 930, __pyx_L1_error)
19337  __Pyx_GOTREF(__pyx_t_3);
19338  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 930, __pyx_L1_error)
19339  __Pyx_GOTREF(__pyx_t_4);
19340  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19341  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 930, __pyx_L1_error)
19342  __Pyx_GOTREF(__pyx_t_3);
19343  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19344  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19345  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19346  __PYX_ERR(1, 930, __pyx_L1_error)
19347 
19348  /* "View.MemoryView":929
19349  * if index < 0:
19350  * index += view.shape[dim]
19351  * if index < 0: # <<<<<<<<<<<<<<
19352  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19353  *
19354  */
19355  }
19356 
19357  /* "View.MemoryView":927
19358  * suboffset = view.suboffsets[dim]
19359  *
19360  * if index < 0: # <<<<<<<<<<<<<<
19361  * index += view.shape[dim]
19362  * if index < 0:
19363  */
19364  }
19365 
19366  /* "View.MemoryView":932
19367  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19368  *
19369  * if index >= shape: # <<<<<<<<<<<<<<
19370  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19371  *
19372  */
19373  __Pyx_TraceLine(932,0,__PYX_ERR(1, 932, __pyx_L1_error))
19374  __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
19375  if (unlikely(__pyx_t_2)) {
19376 
19377  /* "View.MemoryView":933
19378  *
19379  * if index >= shape:
19380  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
19381  *
19382  * resultp = bufp + index * stride
19383  */
19384  __Pyx_TraceLine(933,0,__PYX_ERR(1, 933, __pyx_L1_error))
19385  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 933, __pyx_L1_error)
19386  __Pyx_GOTREF(__pyx_t_3);
19387  __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 933, __pyx_L1_error)
19388  __Pyx_GOTREF(__pyx_t_4);
19389  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19390  __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 933, __pyx_L1_error)
19391  __Pyx_GOTREF(__pyx_t_3);
19392  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19393  __Pyx_Raise(__pyx_t_3, 0, 0, 0);
19394  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19395  __PYX_ERR(1, 933, __pyx_L1_error)
19396 
19397  /* "View.MemoryView":932
19398  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19399  *
19400  * if index >= shape: # <<<<<<<<<<<<<<
19401  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19402  *
19403  */
19404  }
19405 
19406  /* "View.MemoryView":935
19407  * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
19408  *
19409  * resultp = bufp + index * stride # <<<<<<<<<<<<<<
19410  * if suboffset >= 0:
19411  * resultp = (<char **> resultp)[0] + suboffset
19412  */
19413  __Pyx_TraceLine(935,0,__PYX_ERR(1, 935, __pyx_L1_error))
19414  __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
19415 
19416  /* "View.MemoryView":936
19417  *
19418  * resultp = bufp + index * stride
19419  * if suboffset >= 0: # <<<<<<<<<<<<<<
19420  * resultp = (<char **> resultp)[0] + suboffset
19421  *
19422  */
19423  __Pyx_TraceLine(936,0,__PYX_ERR(1, 936, __pyx_L1_error))
19424  __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
19425  if (__pyx_t_2) {
19426 
19427  /* "View.MemoryView":937
19428  * resultp = bufp + index * stride
19429  * if suboffset >= 0:
19430  * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
19431  *
19432  * return resultp
19433  */
19434  __Pyx_TraceLine(937,0,__PYX_ERR(1, 937, __pyx_L1_error))
19435  __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
19436 
19437  /* "View.MemoryView":936
19438  *
19439  * resultp = bufp + index * stride
19440  * if suboffset >= 0: # <<<<<<<<<<<<<<
19441  * resultp = (<char **> resultp)[0] + suboffset
19442  *
19443  */
19444  }
19445 
19446  /* "View.MemoryView":939
19447  * resultp = (<char **> resultp)[0] + suboffset
19448  *
19449  * return resultp # <<<<<<<<<<<<<<
19450  *
19451  *
19452  */
19453  __Pyx_TraceLine(939,0,__PYX_ERR(1, 939, __pyx_L1_error))
19454  __pyx_r = __pyx_v_resultp;
19455  goto __pyx_L0;
19456 
19457  /* "View.MemoryView":912
19458  *
19459  * @cname('__pyx_pybuffer_index')
19460  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
19461  * Py_ssize_t dim) except NULL:
19462  * cdef Py_ssize_t shape, stride, suboffset = -1
19463  */
19464 
19465  /* function exit code */
19466  __pyx_L1_error:;
19467  __Pyx_XDECREF(__pyx_t_3);
19468  __Pyx_XDECREF(__pyx_t_4);
19469  __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
19470  __pyx_r = NULL;
19471  __pyx_L0:;
19472  __Pyx_TraceReturn(Py_None, 0);
19473  __Pyx_RefNannyFinishContext();
19474  return __pyx_r;
19475 }
19476 
19477 /* "View.MemoryView":945
19478  *
19479  * @cname('__pyx_memslice_transpose')
19480  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
19481  * cdef int ndim = memslice.memview.view.ndim
19482  *
19483  */
19484 
19485 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
19486  int __pyx_v_ndim;
19487  Py_ssize_t *__pyx_v_shape;
19488  Py_ssize_t *__pyx_v_strides;
19489  int __pyx_v_i;
19490  int __pyx_v_j;
19491  int __pyx_r;
19492  __Pyx_TraceDeclarations
19493  int __pyx_t_1;
19494  Py_ssize_t *__pyx_t_2;
19495  long __pyx_t_3;
19496  long __pyx_t_4;
19497  Py_ssize_t __pyx_t_5;
19498  Py_ssize_t __pyx_t_6;
19499  int __pyx_t_7;
19500  int __pyx_t_8;
19501  int __pyx_t_9;
19502  int __pyx_lineno = 0;
19503  const char *__pyx_filename = NULL;
19504  int __pyx_clineno = 0;
19505  __Pyx_TraceCall("transpose_memslice", __pyx_f[1], 945, 1, __PYX_ERR(1, 945, __pyx_L1_error));
19506 
19507  /* "View.MemoryView":946
19508  * @cname('__pyx_memslice_transpose')
19509  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
19510  * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
19511  *
19512  * cdef Py_ssize_t *shape = memslice.shape
19513  */
19514  __Pyx_TraceLine(946,1,__PYX_ERR(1, 946, __pyx_L1_error))
19515  __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
19516  __pyx_v_ndim = __pyx_t_1;
19517 
19518  /* "View.MemoryView":948
19519  * cdef int ndim = memslice.memview.view.ndim
19520  *
19521  * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
19522  * cdef Py_ssize_t *strides = memslice.strides
19523  *
19524  */
19525  __Pyx_TraceLine(948,1,__PYX_ERR(1, 948, __pyx_L1_error))
19526  __pyx_t_2 = __pyx_v_memslice->shape;
19527  __pyx_v_shape = __pyx_t_2;
19528 
19529  /* "View.MemoryView":949
19530  *
19531  * cdef Py_ssize_t *shape = memslice.shape
19532  * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
19533  *
19534  *
19535  */
19536  __Pyx_TraceLine(949,1,__PYX_ERR(1, 949, __pyx_L1_error))
19537  __pyx_t_2 = __pyx_v_memslice->strides;
19538  __pyx_v_strides = __pyx_t_2;
19539 
19540  /* "View.MemoryView":953
19541  *
19542  * cdef int i, j
19543  * for i in range(ndim / 2): # <<<<<<<<<<<<<<
19544  * j = ndim - 1 - i
19545  * strides[i], strides[j] = strides[j], strides[i]
19546  */
19547  __Pyx_TraceLine(953,1,__PYX_ERR(1, 953, __pyx_L1_error))
19548  __pyx_t_3 = (__pyx_v_ndim / 2);
19549  __pyx_t_4 = __pyx_t_3;
19550  for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
19551  __pyx_v_i = __pyx_t_1;
19552 
19553  /* "View.MemoryView":954
19554  * cdef int i, j
19555  * for i in range(ndim / 2):
19556  * j = ndim - 1 - i # <<<<<<<<<<<<<<
19557  * strides[i], strides[j] = strides[j], strides[i]
19558  * shape[i], shape[j] = shape[j], shape[i]
19559  */
19560  __Pyx_TraceLine(954,1,__PYX_ERR(1, 954, __pyx_L1_error))
19561  __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
19562 
19563  /* "View.MemoryView":955
19564  * for i in range(ndim / 2):
19565  * j = ndim - 1 - i
19566  * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
19567  * shape[i], shape[j] = shape[j], shape[i]
19568  *
19569  */
19570  __Pyx_TraceLine(955,1,__PYX_ERR(1, 955, __pyx_L1_error))
19571  __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
19572  __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
19573  (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
19574  (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
19575 
19576  /* "View.MemoryView":956
19577  * j = ndim - 1 - i
19578  * strides[i], strides[j] = strides[j], strides[i]
19579  * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
19580  *
19581  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
19582  */
19583  __Pyx_TraceLine(956,1,__PYX_ERR(1, 956, __pyx_L1_error))
19584  __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
19585  __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
19586  (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
19587  (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
19588 
19589  /* "View.MemoryView":958
19590  * shape[i], shape[j] = shape[j], shape[i]
19591  *
19592  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
19593  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
19594  *
19595  */
19596  __Pyx_TraceLine(958,1,__PYX_ERR(1, 958, __pyx_L1_error))
19597  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
19598  if (!__pyx_t_8) {
19599  } else {
19600  __pyx_t_7 = __pyx_t_8;
19601  goto __pyx_L6_bool_binop_done;
19602  }
19603  __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
19604  __pyx_t_7 = __pyx_t_8;
19605  __pyx_L6_bool_binop_done:;
19606  if (__pyx_t_7) {
19607 
19608  /* "View.MemoryView":959
19609  *
19610  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
19611  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
19612  *
19613  * return 1
19614  */
19615  __Pyx_TraceLine(959,1,__PYX_ERR(1, 959, __pyx_L1_error))
19616  __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((char *)"Cannot transpose memoryview with indirect dimensions")); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(1, 959, __pyx_L1_error)
19617 
19618  /* "View.MemoryView":958
19619  * shape[i], shape[j] = shape[j], shape[i]
19620  *
19621  * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
19622  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
19623  *
19624  */
19625  }
19626  }
19627 
19628  /* "View.MemoryView":961
19629  * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
19630  *
19631  * return 1 # <<<<<<<<<<<<<<
19632  *
19633  *
19634  */
19635  __Pyx_TraceLine(961,1,__PYX_ERR(1, 961, __pyx_L1_error))
19636  __pyx_r = 1;
19637  goto __pyx_L0;
19638 
19639  /* "View.MemoryView":945
19640  *
19641  * @cname('__pyx_memslice_transpose')
19642  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
19643  * cdef int ndim = memslice.memview.view.ndim
19644  *
19645  */
19646 
19647  /* function exit code */
19648  __pyx_L1_error:;
19649  {
19650  #ifdef WITH_THREAD
19651  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19652  #endif
19653  __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
19654  #ifdef WITH_THREAD
19655  __Pyx_PyGILState_Release(__pyx_gilstate_save);
19656  #endif
19657  }
19658  __pyx_r = 0;
19659  __pyx_L0:;
19660  __Pyx_TraceReturn(Py_None, 1);
19661  return __pyx_r;
19662 }
19663 
19664 /* "View.MemoryView":978
19665  * cdef int (*to_dtype_func)(char *, object) except 0
19666  *
19667  * def __dealloc__(self): # <<<<<<<<<<<<<<
19668  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
19669  *
19670  */
19671 
19672 /* Python wrapper */
19673 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
19674 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
19675  __Pyx_RefNannyDeclarations
19676  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
19677  __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19678 
19679  /* function exit code */
19680  __Pyx_RefNannyFinishContext();
19681 }
19682 
19683 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19684  __Pyx_TraceDeclarations
19685  __Pyx_RefNannyDeclarations
19686  int __pyx_lineno = 0;
19687  const char *__pyx_filename = NULL;
19688  int __pyx_clineno = 0;
19689  __Pyx_RefNannySetupContext("__dealloc__", 0);
19690  __Pyx_TraceCall("__dealloc__", __pyx_f[1], 978, 0, __PYX_ERR(1, 978, __pyx_L1_error));
19691 
19692  /* "View.MemoryView":979
19693  *
19694  * def __dealloc__(self):
19695  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
19696  *
19697  * cdef convert_item_to_object(self, char *itemp):
19698  */
19699  __Pyx_TraceLine(979,0,__PYX_ERR(1, 979, __pyx_L1_error))
19700  __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
19701 
19702  /* "View.MemoryView":978
19703  * cdef int (*to_dtype_func)(char *, object) except 0
19704  *
19705  * def __dealloc__(self): # <<<<<<<<<<<<<<
19706  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
19707  *
19708  */
19709 
19710  /* function exit code */
19711  goto __pyx_L0;
19712  __pyx_L1_error:;
19713  __Pyx_WriteUnraisable("View.MemoryView._memoryviewslice.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19714  __pyx_L0:;
19715  __Pyx_TraceReturn(Py_None, 0);
19716  __Pyx_RefNannyFinishContext();
19717 }
19718 
19719 /* "View.MemoryView":981
19720  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
19721  *
19722  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
19723  * if self.to_object_func != NULL:
19724  * return self.to_object_func(itemp)
19725  */
19726 
19727 static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
19728  PyObject *__pyx_r = NULL;
19729  __Pyx_TraceDeclarations
19730  __Pyx_RefNannyDeclarations
19731  int __pyx_t_1;
19732  PyObject *__pyx_t_2 = NULL;
19733  int __pyx_lineno = 0;
19734  const char *__pyx_filename = NULL;
19735  int __pyx_clineno = 0;
19736  __Pyx_RefNannySetupContext("convert_item_to_object", 0);
19737  __Pyx_TraceCall("convert_item_to_object", __pyx_f[1], 981, 0, __PYX_ERR(1, 981, __pyx_L1_error));
19738 
19739  /* "View.MemoryView":982
19740  *
19741  * cdef convert_item_to_object(self, char *itemp):
19742  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
19743  * return self.to_object_func(itemp)
19744  * else:
19745  */
19746  __Pyx_TraceLine(982,0,__PYX_ERR(1, 982, __pyx_L1_error))
19747  __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
19748  if (__pyx_t_1) {
19749 
19750  /* "View.MemoryView":983
19751  * cdef convert_item_to_object(self, char *itemp):
19752  * if self.to_object_func != NULL:
19753  * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
19754  * else:
19755  * return memoryview.convert_item_to_object(self, itemp)
19756  */
19757  __Pyx_TraceLine(983,0,__PYX_ERR(1, 983, __pyx_L1_error))
19758  __Pyx_XDECREF(__pyx_r);
19759  __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
19760  __Pyx_GOTREF(__pyx_t_2);
19761  __pyx_r = __pyx_t_2;
19762  __pyx_t_2 = 0;
19763  goto __pyx_L0;
19764 
19765  /* "View.MemoryView":982
19766  *
19767  * cdef convert_item_to_object(self, char *itemp):
19768  * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
19769  * return self.to_object_func(itemp)
19770  * else:
19771  */
19772  }
19773 
19774  /* "View.MemoryView":985
19775  * return self.to_object_func(itemp)
19776  * else:
19777  * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
19778  *
19779  * cdef assign_item_from_object(self, char *itemp, object value):
19780  */
19781  __Pyx_TraceLine(985,0,__PYX_ERR(1, 985, __pyx_L1_error))
19782  /*else*/ {
19783  __Pyx_XDECREF(__pyx_r);
19784  __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 985, __pyx_L1_error)
19785  __Pyx_GOTREF(__pyx_t_2);
19786  __pyx_r = __pyx_t_2;
19787  __pyx_t_2 = 0;
19788  goto __pyx_L0;
19789  }
19790 
19791  /* "View.MemoryView":981
19792  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
19793  *
19794  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
19795  * if self.to_object_func != NULL:
19796  * return self.to_object_func(itemp)
19797  */
19798 
19799  /* function exit code */
19800  __pyx_L1_error:;
19801  __Pyx_XDECREF(__pyx_t_2);
19802  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19803  __pyx_r = 0;
19804  __pyx_L0:;
19805  __Pyx_XGIVEREF(__pyx_r);
19806  __Pyx_TraceReturn(__pyx_r, 0);
19807  __Pyx_RefNannyFinishContext();
19808  return __pyx_r;
19809 }
19810 
19811 /* "View.MemoryView":987
19812  * return memoryview.convert_item_to_object(self, itemp)
19813  *
19814  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
19815  * if self.to_dtype_func != NULL:
19816  * self.to_dtype_func(itemp, value)
19817  */
19818 
19819 static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
19820  PyObject *__pyx_r = NULL;
19821  __Pyx_TraceDeclarations
19822  __Pyx_RefNannyDeclarations
19823  int __pyx_t_1;
19824  int __pyx_t_2;
19825  PyObject *__pyx_t_3 = NULL;
19826  int __pyx_lineno = 0;
19827  const char *__pyx_filename = NULL;
19828  int __pyx_clineno = 0;
19829  __Pyx_RefNannySetupContext("assign_item_from_object", 0);
19830  __Pyx_TraceCall("assign_item_from_object", __pyx_f[1], 987, 0, __PYX_ERR(1, 987, __pyx_L1_error));
19831 
19832  /* "View.MemoryView":988
19833  *
19834  * cdef assign_item_from_object(self, char *itemp, object value):
19835  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
19836  * self.to_dtype_func(itemp, value)
19837  * else:
19838  */
19839  __Pyx_TraceLine(988,0,__PYX_ERR(1, 988, __pyx_L1_error))
19840  __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
19841  if (__pyx_t_1) {
19842 
19843  /* "View.MemoryView":989
19844  * cdef assign_item_from_object(self, char *itemp, object value):
19845  * if self.to_dtype_func != NULL:
19846  * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
19847  * else:
19848  * memoryview.assign_item_from_object(self, itemp, value)
19849  */
19850  __Pyx_TraceLine(989,0,__PYX_ERR(1, 989, __pyx_L1_error))
19851  __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(1, 989, __pyx_L1_error)
19852 
19853  /* "View.MemoryView":988
19854  *
19855  * cdef assign_item_from_object(self, char *itemp, object value):
19856  * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
19857  * self.to_dtype_func(itemp, value)
19858  * else:
19859  */
19860  goto __pyx_L3;
19861  }
19862 
19863  /* "View.MemoryView":991
19864  * self.to_dtype_func(itemp, value)
19865  * else:
19866  * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
19867  *
19868  * @property
19869  */
19870  __Pyx_TraceLine(991,0,__PYX_ERR(1, 991, __pyx_L1_error))
19871  /*else*/ {
19872  __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 991, __pyx_L1_error)
19873  __Pyx_GOTREF(__pyx_t_3);
19874  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19875  }
19876  __pyx_L3:;
19877 
19878  /* "View.MemoryView":987
19879  * return memoryview.convert_item_to_object(self, itemp)
19880  *
19881  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
19882  * if self.to_dtype_func != NULL:
19883  * self.to_dtype_func(itemp, value)
19884  */
19885 
19886  /* function exit code */
19887  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
19888  goto __pyx_L0;
19889  __pyx_L1_error:;
19890  __Pyx_XDECREF(__pyx_t_3);
19891  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
19892  __pyx_r = 0;
19893  __pyx_L0:;
19894  __Pyx_XGIVEREF(__pyx_r);
19895  __Pyx_TraceReturn(__pyx_r, 0);
19896  __Pyx_RefNannyFinishContext();
19897  return __pyx_r;
19898 }
19899 
19900 /* "View.MemoryView":994
19901  *
19902  * @property
19903  * def base(self): # <<<<<<<<<<<<<<
19904  * return self.from_object
19905  *
19906  */
19907 
19908 /* Python wrapper */
19909 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
19910 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
19911  PyObject *__pyx_r = 0;
19912  __Pyx_RefNannyDeclarations
19913  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
19914  __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19915 
19916  /* function exit code */
19917  __Pyx_RefNannyFinishContext();
19918  return __pyx_r;
19919 }
19920 
19921 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19922  PyObject *__pyx_r = NULL;
19923  __Pyx_TraceDeclarations
19924  __Pyx_RefNannyDeclarations
19925  int __pyx_lineno = 0;
19926  const char *__pyx_filename = NULL;
19927  int __pyx_clineno = 0;
19928  __Pyx_RefNannySetupContext("__get__", 0);
19929  __Pyx_TraceCall("__get__", __pyx_f[1], 994, 0, __PYX_ERR(1, 994, __pyx_L1_error));
19930 
19931  /* "View.MemoryView":995
19932  * @property
19933  * def base(self):
19934  * return self.from_object # <<<<<<<<<<<<<<
19935  *
19936  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
19937  */
19938  __Pyx_TraceLine(995,0,__PYX_ERR(1, 995, __pyx_L1_error))
19939  __Pyx_XDECREF(__pyx_r);
19940  __Pyx_INCREF(__pyx_v_self->from_object);
19941  __pyx_r = __pyx_v_self->from_object;
19942  goto __pyx_L0;
19943 
19944  /* "View.MemoryView":994
19945  *
19946  * @property
19947  * def base(self): # <<<<<<<<<<<<<<
19948  * return self.from_object
19949  *
19950  */
19951 
19952  /* function exit code */
19953  __pyx_L1_error:;
19954  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
19955  __pyx_r = NULL;
19956  __pyx_L0:;
19957  __Pyx_XGIVEREF(__pyx_r);
19958  __Pyx_TraceReturn(__pyx_r, 0);
19959  __Pyx_RefNannyFinishContext();
19960  return __pyx_r;
19961 }
19962 
19963 /* "(tree fragment)":1
19964  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
19965  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19966  * def __setstate_cython__(self, __pyx_state):
19967  */
19968 
19969 /* Python wrapper */
19970 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
19971 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_1__reduce_cython__ = {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0};
19972 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
19973  PyObject *__pyx_r = 0;
19974  __Pyx_RefNannyDeclarations
19975  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
19976  __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
19977 
19978  /* function exit code */
19979  __Pyx_RefNannyFinishContext();
19980  return __pyx_r;
19981 }
19982 
19983 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
19984  PyObject *__pyx_r = NULL;
19985  __Pyx_TraceDeclarations
19986  __Pyx_RefNannyDeclarations
19987  PyObject *__pyx_t_1 = NULL;
19988  int __pyx_lineno = 0;
19989  const char *__pyx_filename = NULL;
19990  int __pyx_clineno = 0;
19991  __Pyx_RefNannySetupContext("__reduce_cython__", 0);
19992  __Pyx_TraceCall("__reduce_cython__", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
19993 
19994  /* "(tree fragment)":2
19995  * def __reduce_cython__(self):
19996  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
19997  * def __setstate_cython__(self, __pyx_state):
19998  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
19999  */
20000  __Pyx_TraceLine(2,0,__PYX_ERR(1, 2, __pyx_L1_error))
20001  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
20002  __Pyx_GOTREF(__pyx_t_1);
20003  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20004  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20005  __PYX_ERR(1, 2, __pyx_L1_error)
20006 
20007  /* "(tree fragment)":1
20008  * def __reduce_cython__(self): # <<<<<<<<<<<<<<
20009  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20010  * def __setstate_cython__(self, __pyx_state):
20011  */
20012 
20013  /* function exit code */
20014  __pyx_L1_error:;
20015  __Pyx_XDECREF(__pyx_t_1);
20016  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20017  __pyx_r = NULL;
20018  __Pyx_XGIVEREF(__pyx_r);
20019  __Pyx_TraceReturn(__pyx_r, 0);
20020  __Pyx_RefNannyFinishContext();
20021  return __pyx_r;
20022 }
20023 
20024 /* "(tree fragment)":3
20025  * def __reduce_cython__(self):
20026  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20027  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
20028  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20029  */
20030 
20031 /* Python wrapper */
20032 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
20033 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_3__setstate_cython__ = {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0};
20034 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
20035  PyObject *__pyx_r = 0;
20036  __Pyx_RefNannyDeclarations
20037  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
20038  __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
20039 
20040  /* function exit code */
20041  __Pyx_RefNannyFinishContext();
20042  return __pyx_r;
20043 }
20044 
20045 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
20046  PyObject *__pyx_r = NULL;
20047  __Pyx_TraceDeclarations
20048  __Pyx_RefNannyDeclarations
20049  PyObject *__pyx_t_1 = NULL;
20050  int __pyx_lineno = 0;
20051  const char *__pyx_filename = NULL;
20052  int __pyx_clineno = 0;
20053  __Pyx_RefNannySetupContext("__setstate_cython__", 0);
20054  __Pyx_TraceCall("__setstate_cython__", __pyx_f[1], 3, 0, __PYX_ERR(1, 3, __pyx_L1_error));
20055 
20056  /* "(tree fragment)":4
20057  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20058  * def __setstate_cython__(self, __pyx_state):
20059  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
20060  */
20061  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
20062  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
20063  __Pyx_GOTREF(__pyx_t_1);
20064  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
20065  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20066  __PYX_ERR(1, 4, __pyx_L1_error)
20067 
20068  /* "(tree fragment)":3
20069  * def __reduce_cython__(self):
20070  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20071  * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
20072  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
20073  */
20074 
20075  /* function exit code */
20076  __pyx_L1_error:;
20077  __Pyx_XDECREF(__pyx_t_1);
20078  __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
20079  __pyx_r = NULL;
20080  __Pyx_XGIVEREF(__pyx_r);
20081  __Pyx_TraceReturn(__pyx_r, 0);
20082  __Pyx_RefNannyFinishContext();
20083  return __pyx_r;
20084 }
20085 
20086 /* "View.MemoryView":1001
20087  *
20088  * @cname('__pyx_memoryview_fromslice')
20089  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
20090  * int ndim,
20091  * object (*to_object_func)(char *),
20092  */
20093 
20094 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice, int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(char *), int (*__pyx_v_to_dtype_func)(char *, PyObject *), int __pyx_v_dtype_is_object) {
20095  struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
20096  Py_ssize_t __pyx_v_suboffset;
20097  PyObject *__pyx_v_length = NULL;
20098  PyObject *__pyx_r = NULL;
20099  __Pyx_TraceDeclarations
20100  __Pyx_RefNannyDeclarations
20101  int __pyx_t_1;
20102  PyObject *__pyx_t_2 = NULL;
20103  PyObject *__pyx_t_3 = NULL;
20104  __Pyx_TypeInfo *__pyx_t_4;
20105  Py_buffer __pyx_t_5;
20106  Py_ssize_t *__pyx_t_6;
20107  Py_ssize_t *__pyx_t_7;
20108  Py_ssize_t *__pyx_t_8;
20109  Py_ssize_t __pyx_t_9;
20110  int __pyx_lineno = 0;
20111  const char *__pyx_filename = NULL;
20112  int __pyx_clineno = 0;
20113  __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
20114  __Pyx_TraceCall("memoryview_fromslice", __pyx_f[1], 1001, 0, __PYX_ERR(1, 1001, __pyx_L1_error));
20115 
20116  /* "View.MemoryView":1009
20117  * cdef _memoryviewslice result
20118  *
20119  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
20120  * return None
20121  *
20122  */
20123  __Pyx_TraceLine(1009,0,__PYX_ERR(1, 1009, __pyx_L1_error))
20124  __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
20125  if (__pyx_t_1) {
20126 
20127  /* "View.MemoryView":1010
20128  *
20129  * if <PyObject *> memviewslice.memview == Py_None:
20130  * return None # <<<<<<<<<<<<<<
20131  *
20132  *
20133  */
20134  __Pyx_TraceLine(1010,0,__PYX_ERR(1, 1010, __pyx_L1_error))
20135  __Pyx_XDECREF(__pyx_r);
20136  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20137  goto __pyx_L0;
20138 
20139  /* "View.MemoryView":1009
20140  * cdef _memoryviewslice result
20141  *
20142  * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
20143  * return None
20144  *
20145  */
20146  }
20147 
20148  /* "View.MemoryView":1015
20149  *
20150  *
20151  * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
20152  *
20153  * result.from_slice = memviewslice
20154  */
20155  __Pyx_TraceLine(1015,0,__PYX_ERR(1, 1015, __pyx_L1_error))
20156  __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1015, __pyx_L1_error)
20157  __Pyx_GOTREF(__pyx_t_2);
20158  __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1015, __pyx_L1_error)
20159  __Pyx_GOTREF(__pyx_t_3);
20160  __Pyx_INCREF(Py_None);
20161  __Pyx_GIVEREF(Py_None);
20162  PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
20163  __Pyx_INCREF(__pyx_int_0);
20164  __Pyx_GIVEREF(__pyx_int_0);
20165  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
20166  __Pyx_GIVEREF(__pyx_t_2);
20167  PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
20168  __pyx_t_2 = 0;
20169  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1015, __pyx_L1_error)
20170  __Pyx_GOTREF(__pyx_t_2);
20171  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20172  __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
20173  __pyx_t_2 = 0;
20174 
20175  /* "View.MemoryView":1017
20176  * result = _memoryviewslice(None, 0, dtype_is_object)
20177  *
20178  * result.from_slice = memviewslice # <<<<<<<<<<<<<<
20179  * __PYX_INC_MEMVIEW(&memviewslice, 1)
20180  *
20181  */
20182  __Pyx_TraceLine(1017,0,__PYX_ERR(1, 1017, __pyx_L1_error))
20183  __pyx_v_result->from_slice = __pyx_v_memviewslice;
20184 
20185  /* "View.MemoryView":1018
20186  *
20187  * result.from_slice = memviewslice
20188  * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
20189  *
20190  * result.from_object = (<memoryview> memviewslice.memview).base
20191  */
20192  __Pyx_TraceLine(1018,0,__PYX_ERR(1, 1018, __pyx_L1_error))
20193  __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
20194 
20195  /* "View.MemoryView":1020
20196  * __PYX_INC_MEMVIEW(&memviewslice, 1)
20197  *
20198  * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
20199  * result.typeinfo = memviewslice.memview.typeinfo
20200  *
20201  */
20202  __Pyx_TraceLine(1020,0,__PYX_ERR(1, 1020, __pyx_L1_error))
20203  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1020, __pyx_L1_error)
20204  __Pyx_GOTREF(__pyx_t_2);
20205  __Pyx_GIVEREF(__pyx_t_2);
20206  __Pyx_GOTREF(__pyx_v_result->from_object);
20207  __Pyx_DECREF(__pyx_v_result->from_object);
20208  __pyx_v_result->from_object = __pyx_t_2;
20209  __pyx_t_2 = 0;
20210 
20211  /* "View.MemoryView":1021
20212  *
20213  * result.from_object = (<memoryview> memviewslice.memview).base
20214  * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
20215  *
20216  * result.view = memviewslice.memview.view
20217  */
20218  __Pyx_TraceLine(1021,0,__PYX_ERR(1, 1021, __pyx_L1_error))
20219  __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
20220  __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
20221 
20222  /* "View.MemoryView":1023
20223  * result.typeinfo = memviewslice.memview.typeinfo
20224  *
20225  * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
20226  * result.view.buf = <void *> memviewslice.data
20227  * result.view.ndim = ndim
20228  */
20229  __Pyx_TraceLine(1023,0,__PYX_ERR(1, 1023, __pyx_L1_error))
20230  __pyx_t_5 = __pyx_v_memviewslice.memview->view;
20231  __pyx_v_result->__pyx_base.view = __pyx_t_5;
20232 
20233  /* "View.MemoryView":1024
20234  *
20235  * result.view = memviewslice.memview.view
20236  * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
20237  * result.view.ndim = ndim
20238  * (<__pyx_buffer *> &result.view).obj = Py_None
20239  */
20240  __Pyx_TraceLine(1024,0,__PYX_ERR(1, 1024, __pyx_L1_error))
20241  __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
20242 
20243  /* "View.MemoryView":1025
20244  * result.view = memviewslice.memview.view
20245  * result.view.buf = <void *> memviewslice.data
20246  * result.view.ndim = ndim # <<<<<<<<<<<<<<
20247  * (<__pyx_buffer *> &result.view).obj = Py_None
20248  * Py_INCREF(Py_None)
20249  */
20250  __Pyx_TraceLine(1025,0,__PYX_ERR(1, 1025, __pyx_L1_error))
20251  __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
20252 
20253  /* "View.MemoryView":1026
20254  * result.view.buf = <void *> memviewslice.data
20255  * result.view.ndim = ndim
20256  * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
20257  * Py_INCREF(Py_None)
20258  *
20259  */
20260  __Pyx_TraceLine(1026,0,__PYX_ERR(1, 1026, __pyx_L1_error))
20261  ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
20262 
20263  /* "View.MemoryView":1027
20264  * result.view.ndim = ndim
20265  * (<__pyx_buffer *> &result.view).obj = Py_None
20266  * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
20267  *
20268  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
20269  */
20270  __Pyx_TraceLine(1027,0,__PYX_ERR(1, 1027, __pyx_L1_error))
20271  Py_INCREF(Py_None);
20272 
20273  /* "View.MemoryView":1029
20274  * Py_INCREF(Py_None)
20275  *
20276  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
20277  * result.flags = PyBUF_RECORDS
20278  * else:
20279  */
20280  __Pyx_TraceLine(1029,0,__PYX_ERR(1, 1029, __pyx_L1_error))
20281  __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
20282  if (__pyx_t_1) {
20283 
20284  /* "View.MemoryView":1030
20285  *
20286  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
20287  * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
20288  * else:
20289  * result.flags = PyBUF_RECORDS_RO
20290  */
20291  __Pyx_TraceLine(1030,0,__PYX_ERR(1, 1030, __pyx_L1_error))
20292  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
20293 
20294  /* "View.MemoryView":1029
20295  * Py_INCREF(Py_None)
20296  *
20297  * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
20298  * result.flags = PyBUF_RECORDS
20299  * else:
20300  */
20301  goto __pyx_L4;
20302  }
20303 
20304  /* "View.MemoryView":1032
20305  * result.flags = PyBUF_RECORDS
20306  * else:
20307  * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
20308  *
20309  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
20310  */
20311  __Pyx_TraceLine(1032,0,__PYX_ERR(1, 1032, __pyx_L1_error))
20312  /*else*/ {
20313  __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
20314  }
20315  __pyx_L4:;
20316 
20317  /* "View.MemoryView":1034
20318  * result.flags = PyBUF_RECORDS_RO
20319  *
20320  * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
20321  * result.view.strides = <Py_ssize_t *> result.from_slice.strides
20322  *
20323  */
20324  __Pyx_TraceLine(1034,0,__PYX_ERR(1, 1034, __pyx_L1_error))
20325  __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
20326 
20327  /* "View.MemoryView":1035
20328  *
20329  * result.view.shape = <Py_ssize_t *> result.from_slice.shape
20330  * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
20331  *
20332  *
20333  */
20334  __Pyx_TraceLine(1035,0,__PYX_ERR(1, 1035, __pyx_L1_error))
20335  __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
20336 
20337  /* "View.MemoryView":1038
20338  *
20339  *
20340  * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
20341  * for suboffset in result.from_slice.suboffsets[:ndim]:
20342  * if suboffset >= 0:
20343  */
20344  __Pyx_TraceLine(1038,0,__PYX_ERR(1, 1038, __pyx_L1_error))
20345  __pyx_v_result->__pyx_base.view.suboffsets = NULL;
20346 
20347  /* "View.MemoryView":1039
20348  *
20349  * result.view.suboffsets = NULL
20350  * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
20351  * if suboffset >= 0:
20352  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
20353  */
20354  __Pyx_TraceLine(1039,0,__PYX_ERR(1, 1039, __pyx_L1_error))
20355  __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
20356  for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
20357  __pyx_t_6 = __pyx_t_8;
20358  __pyx_v_suboffset = (__pyx_t_6[0]);
20359 
20360  /* "View.MemoryView":1040
20361  * result.view.suboffsets = NULL
20362  * for suboffset in result.from_slice.suboffsets[:ndim]:
20363  * if suboffset >= 0: # <<<<<<<<<<<<<<
20364  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
20365  * break
20366  */
20367  __Pyx_TraceLine(1040,0,__PYX_ERR(1, 1040, __pyx_L1_error))
20368  __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
20369  if (__pyx_t_1) {
20370 
20371  /* "View.MemoryView":1041
20372  * for suboffset in result.from_slice.suboffsets[:ndim]:
20373  * if suboffset >= 0:
20374  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
20375  * break
20376  *
20377  */
20378  __Pyx_TraceLine(1041,0,__PYX_ERR(1, 1041, __pyx_L1_error))
20379  __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
20380 
20381  /* "View.MemoryView":1042
20382  * if suboffset >= 0:
20383  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
20384  * break # <<<<<<<<<<<<<<
20385  *
20386  * result.view.len = result.view.itemsize
20387  */
20388  __Pyx_TraceLine(1042,0,__PYX_ERR(1, 1042, __pyx_L1_error))
20389  goto __pyx_L6_break;
20390 
20391  /* "View.MemoryView":1040
20392  * result.view.suboffsets = NULL
20393  * for suboffset in result.from_slice.suboffsets[:ndim]:
20394  * if suboffset >= 0: # <<<<<<<<<<<<<<
20395  * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
20396  * break
20397  */
20398  }
20399  }
20400  __pyx_L6_break:;
20401 
20402  /* "View.MemoryView":1044
20403  * break
20404  *
20405  * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
20406  * for length in result.view.shape[:ndim]:
20407  * result.view.len *= length
20408  */
20409  __Pyx_TraceLine(1044,0,__PYX_ERR(1, 1044, __pyx_L1_error))
20410  __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
20411  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
20412 
20413  /* "View.MemoryView":1045
20414  *
20415  * result.view.len = result.view.itemsize
20416  * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
20417  * result.view.len *= length
20418  *
20419  */
20420  __Pyx_TraceLine(1045,0,__PYX_ERR(1, 1045, __pyx_L1_error))
20421  __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
20422  for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
20423  __pyx_t_6 = __pyx_t_8;
20424  __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1045, __pyx_L1_error)
20425  __Pyx_GOTREF(__pyx_t_2);
20426  __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
20427  __pyx_t_2 = 0;
20428 
20429  /* "View.MemoryView":1046
20430  * result.view.len = result.view.itemsize
20431  * for length in result.view.shape[:ndim]:
20432  * result.view.len *= length # <<<<<<<<<<<<<<
20433  *
20434  * result.to_object_func = to_object_func
20435  */
20436  __Pyx_TraceLine(1046,0,__PYX_ERR(1, 1046, __pyx_L1_error))
20437  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1046, __pyx_L1_error)
20438  __Pyx_GOTREF(__pyx_t_2);
20439  __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1046, __pyx_L1_error)
20440  __Pyx_GOTREF(__pyx_t_3);
20441  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20442  __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1046, __pyx_L1_error)
20443  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20444  __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
20445  }
20446 
20447  /* "View.MemoryView":1048
20448  * result.view.len *= length
20449  *
20450  * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
20451  * result.to_dtype_func = to_dtype_func
20452  *
20453  */
20454  __Pyx_TraceLine(1048,0,__PYX_ERR(1, 1048, __pyx_L1_error))
20455  __pyx_v_result->to_object_func = __pyx_v_to_object_func;
20456 
20457  /* "View.MemoryView":1049
20458  *
20459  * result.to_object_func = to_object_func
20460  * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
20461  *
20462  * return result
20463  */
20464  __Pyx_TraceLine(1049,0,__PYX_ERR(1, 1049, __pyx_L1_error))
20465  __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
20466 
20467  /* "View.MemoryView":1051
20468  * result.to_dtype_func = to_dtype_func
20469  *
20470  * return result # <<<<<<<<<<<<<<
20471  *
20472  * @cname('__pyx_memoryview_get_slice_from_memoryview')
20473  */
20474  __Pyx_TraceLine(1051,0,__PYX_ERR(1, 1051, __pyx_L1_error))
20475  __Pyx_XDECREF(__pyx_r);
20476  __Pyx_INCREF(((PyObject *)__pyx_v_result));
20477  __pyx_r = ((PyObject *)__pyx_v_result);
20478  goto __pyx_L0;
20479 
20480  /* "View.MemoryView":1001
20481  *
20482  * @cname('__pyx_memoryview_fromslice')
20483  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
20484  * int ndim,
20485  * object (*to_object_func)(char *),
20486  */
20487 
20488  /* function exit code */
20489  __pyx_L1_error:;
20490  __Pyx_XDECREF(__pyx_t_2);
20491  __Pyx_XDECREF(__pyx_t_3);
20492  __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20493  __pyx_r = 0;
20494  __pyx_L0:;
20495  __Pyx_XDECREF((PyObject *)__pyx_v_result);
20496  __Pyx_XDECREF(__pyx_v_length);
20497  __Pyx_XGIVEREF(__pyx_r);
20498  __Pyx_TraceReturn(__pyx_r, 0);
20499  __Pyx_RefNannyFinishContext();
20500  return __pyx_r;
20501 }
20502 
20503 /* "View.MemoryView":1054
20504  *
20505  * @cname('__pyx_memoryview_get_slice_from_memoryview')
20506  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
20507  * __Pyx_memviewslice *mslice) except NULL:
20508  * cdef _memoryviewslice obj
20509  */
20510 
20511 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
20512  struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
20513  __Pyx_memviewslice *__pyx_r;
20514  __Pyx_TraceDeclarations
20515  __Pyx_RefNannyDeclarations
20516  int __pyx_t_1;
20517  int __pyx_t_2;
20518  PyObject *__pyx_t_3 = NULL;
20519  int __pyx_lineno = 0;
20520  const char *__pyx_filename = NULL;
20521  int __pyx_clineno = 0;
20522  __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
20523  __Pyx_TraceCall("get_slice_from_memview", __pyx_f[1], 1054, 0, __PYX_ERR(1, 1054, __pyx_L1_error));
20524 
20525  /* "View.MemoryView":1057
20526  * __Pyx_memviewslice *mslice) except NULL:
20527  * cdef _memoryviewslice obj
20528  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
20529  * obj = memview
20530  * return &obj.from_slice
20531  */
20532  __Pyx_TraceLine(1057,0,__PYX_ERR(1, 1057, __pyx_L1_error))
20533  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
20534  __pyx_t_2 = (__pyx_t_1 != 0);
20535  if (__pyx_t_2) {
20536 
20537  /* "View.MemoryView":1058
20538  * cdef _memoryviewslice obj
20539  * if isinstance(memview, _memoryviewslice):
20540  * obj = memview # <<<<<<<<<<<<<<
20541  * return &obj.from_slice
20542  * else:
20543  */
20544  __Pyx_TraceLine(1058,0,__PYX_ERR(1, 1058, __pyx_L1_error))
20545  if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1058, __pyx_L1_error)
20546  __pyx_t_3 = ((PyObject *)__pyx_v_memview);
20547  __Pyx_INCREF(__pyx_t_3);
20548  __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
20549  __pyx_t_3 = 0;
20550 
20551  /* "View.MemoryView":1059
20552  * if isinstance(memview, _memoryviewslice):
20553  * obj = memview
20554  * return &obj.from_slice # <<<<<<<<<<<<<<
20555  * else:
20556  * slice_copy(memview, mslice)
20557  */
20558  __Pyx_TraceLine(1059,0,__PYX_ERR(1, 1059, __pyx_L1_error))
20559  __pyx_r = (&__pyx_v_obj->from_slice);
20560  goto __pyx_L0;
20561 
20562  /* "View.MemoryView":1057
20563  * __Pyx_memviewslice *mslice) except NULL:
20564  * cdef _memoryviewslice obj
20565  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
20566  * obj = memview
20567  * return &obj.from_slice
20568  */
20569  }
20570 
20571  /* "View.MemoryView":1061
20572  * return &obj.from_slice
20573  * else:
20574  * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
20575  * return mslice
20576  *
20577  */
20578  __Pyx_TraceLine(1061,0,__PYX_ERR(1, 1061, __pyx_L1_error))
20579  /*else*/ {
20580  __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
20581 
20582  /* "View.MemoryView":1062
20583  * else:
20584  * slice_copy(memview, mslice)
20585  * return mslice # <<<<<<<<<<<<<<
20586  *
20587  * @cname('__pyx_memoryview_slice_copy')
20588  */
20589  __Pyx_TraceLine(1062,0,__PYX_ERR(1, 1062, __pyx_L1_error))
20590  __pyx_r = __pyx_v_mslice;
20591  goto __pyx_L0;
20592  }
20593 
20594  /* "View.MemoryView":1054
20595  *
20596  * @cname('__pyx_memoryview_get_slice_from_memoryview')
20597  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
20598  * __Pyx_memviewslice *mslice) except NULL:
20599  * cdef _memoryviewslice obj
20600  */
20601 
20602  /* function exit code */
20603  __pyx_L1_error:;
20604  __Pyx_XDECREF(__pyx_t_3);
20605  __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
20606  __pyx_r = NULL;
20607  __pyx_L0:;
20608  __Pyx_XDECREF((PyObject *)__pyx_v_obj);
20609  __Pyx_TraceReturn(Py_None, 0);
20610  __Pyx_RefNannyFinishContext();
20611  return __pyx_r;
20612 }
20613 
20614 /* "View.MemoryView":1065
20615  *
20616  * @cname('__pyx_memoryview_slice_copy')
20617  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
20618  * cdef int dim
20619  * cdef (Py_ssize_t*) shape, strides, suboffsets
20620  */
20621 
20622 static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
20623  int __pyx_v_dim;
20624  Py_ssize_t *__pyx_v_shape;
20625  Py_ssize_t *__pyx_v_strides;
20626  Py_ssize_t *__pyx_v_suboffsets;
20627  __Pyx_TraceDeclarations
20628  __Pyx_RefNannyDeclarations
20629  Py_ssize_t *__pyx_t_1;
20630  int __pyx_t_2;
20631  int __pyx_t_3;
20632  int __pyx_t_4;
20633  Py_ssize_t __pyx_t_5;
20634  int __pyx_lineno = 0;
20635  const char *__pyx_filename = NULL;
20636  int __pyx_clineno = 0;
20637  __Pyx_RefNannySetupContext("slice_copy", 0);
20638  __Pyx_TraceCall("slice_copy", __pyx_f[1], 1065, 0, __PYX_ERR(1, 1065, __pyx_L1_error));
20639 
20640  /* "View.MemoryView":1069
20641  * cdef (Py_ssize_t*) shape, strides, suboffsets
20642  *
20643  * shape = memview.view.shape # <<<<<<<<<<<<<<
20644  * strides = memview.view.strides
20645  * suboffsets = memview.view.suboffsets
20646  */
20647  __Pyx_TraceLine(1069,0,__PYX_ERR(1, 1069, __pyx_L1_error))
20648  __pyx_t_1 = __pyx_v_memview->view.shape;
20649  __pyx_v_shape = __pyx_t_1;
20650 
20651  /* "View.MemoryView":1070
20652  *
20653  * shape = memview.view.shape
20654  * strides = memview.view.strides # <<<<<<<<<<<<<<
20655  * suboffsets = memview.view.suboffsets
20656  *
20657  */
20658  __Pyx_TraceLine(1070,0,__PYX_ERR(1, 1070, __pyx_L1_error))
20659  __pyx_t_1 = __pyx_v_memview->view.strides;
20660  __pyx_v_strides = __pyx_t_1;
20661 
20662  /* "View.MemoryView":1071
20663  * shape = memview.view.shape
20664  * strides = memview.view.strides
20665  * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
20666  *
20667  * dst.memview = <__pyx_memoryview *> memview
20668  */
20669  __Pyx_TraceLine(1071,0,__PYX_ERR(1, 1071, __pyx_L1_error))
20670  __pyx_t_1 = __pyx_v_memview->view.suboffsets;
20671  __pyx_v_suboffsets = __pyx_t_1;
20672 
20673  /* "View.MemoryView":1073
20674  * suboffsets = memview.view.suboffsets
20675  *
20676  * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
20677  * dst.data = <char *> memview.view.buf
20678  *
20679  */
20680  __Pyx_TraceLine(1073,0,__PYX_ERR(1, 1073, __pyx_L1_error))
20681  __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
20682 
20683  /* "View.MemoryView":1074
20684  *
20685  * dst.memview = <__pyx_memoryview *> memview
20686  * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
20687  *
20688  * for dim in range(memview.view.ndim):
20689  */
20690  __Pyx_TraceLine(1074,0,__PYX_ERR(1, 1074, __pyx_L1_error))
20691  __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
20692 
20693  /* "View.MemoryView":1076
20694  * dst.data = <char *> memview.view.buf
20695  *
20696  * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
20697  * dst.shape[dim] = shape[dim]
20698  * dst.strides[dim] = strides[dim]
20699  */
20700  __Pyx_TraceLine(1076,0,__PYX_ERR(1, 1076, __pyx_L1_error))
20701  __pyx_t_2 = __pyx_v_memview->view.ndim;
20702  __pyx_t_3 = __pyx_t_2;
20703  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20704  __pyx_v_dim = __pyx_t_4;
20705 
20706  /* "View.MemoryView":1077
20707  *
20708  * for dim in range(memview.view.ndim):
20709  * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
20710  * dst.strides[dim] = strides[dim]
20711  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
20712  */
20713  __Pyx_TraceLine(1077,0,__PYX_ERR(1, 1077, __pyx_L1_error))
20714  (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
20715 
20716  /* "View.MemoryView":1078
20717  * for dim in range(memview.view.ndim):
20718  * dst.shape[dim] = shape[dim]
20719  * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
20720  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
20721  *
20722  */
20723  __Pyx_TraceLine(1078,0,__PYX_ERR(1, 1078, __pyx_L1_error))
20724  (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
20725 
20726  /* "View.MemoryView":1079
20727  * dst.shape[dim] = shape[dim]
20728  * dst.strides[dim] = strides[dim]
20729  * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
20730  *
20731  * @cname('__pyx_memoryview_copy_object')
20732  */
20733  __Pyx_TraceLine(1079,0,__PYX_ERR(1, 1079, __pyx_L1_error))
20734  if ((__pyx_v_suboffsets != 0)) {
20735  __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
20736  } else {
20737  __pyx_t_5 = -1L;
20738  }
20739  (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
20740  }
20741 
20742  /* "View.MemoryView":1065
20743  *
20744  * @cname('__pyx_memoryview_slice_copy')
20745  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
20746  * cdef int dim
20747  * cdef (Py_ssize_t*) shape, strides, suboffsets
20748  */
20749 
20750  /* function exit code */
20751  goto __pyx_L0;
20752  __pyx_L1_error:;
20753  __Pyx_WriteUnraisable("View.MemoryView.slice_copy", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
20754  __pyx_L0:;
20755  __Pyx_TraceReturn(Py_None, 0);
20756  __Pyx_RefNannyFinishContext();
20757 }
20758 
20759 /* "View.MemoryView":1082
20760  *
20761  * @cname('__pyx_memoryview_copy_object')
20762  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
20763  * "Create a new memoryview object"
20764  * cdef __Pyx_memviewslice memviewslice
20765  */
20766 
20767 static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
20768  __Pyx_memviewslice __pyx_v_memviewslice;
20769  PyObject *__pyx_r = NULL;
20770  __Pyx_TraceDeclarations
20771  __Pyx_RefNannyDeclarations
20772  PyObject *__pyx_t_1 = NULL;
20773  int __pyx_lineno = 0;
20774  const char *__pyx_filename = NULL;
20775  int __pyx_clineno = 0;
20776  __Pyx_RefNannySetupContext("memoryview_copy", 0);
20777  __Pyx_TraceCall("memoryview_copy", __pyx_f[1], 1082, 0, __PYX_ERR(1, 1082, __pyx_L1_error));
20778 
20779  /* "View.MemoryView":1085
20780  * "Create a new memoryview object"
20781  * cdef __Pyx_memviewslice memviewslice
20782  * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
20783  * return memoryview_copy_from_slice(memview, &memviewslice)
20784  *
20785  */
20786  __Pyx_TraceLine(1085,0,__PYX_ERR(1, 1085, __pyx_L1_error))
20787  __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
20788 
20789  /* "View.MemoryView":1086
20790  * cdef __Pyx_memviewslice memviewslice
20791  * slice_copy(memview, &memviewslice)
20792  * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
20793  *
20794  * @cname('__pyx_memoryview_copy_object_from_slice')
20795  */
20796  __Pyx_TraceLine(1086,0,__PYX_ERR(1, 1086, __pyx_L1_error))
20797  __Pyx_XDECREF(__pyx_r);
20798  __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1086, __pyx_L1_error)
20799  __Pyx_GOTREF(__pyx_t_1);
20800  __pyx_r = __pyx_t_1;
20801  __pyx_t_1 = 0;
20802  goto __pyx_L0;
20803 
20804  /* "View.MemoryView":1082
20805  *
20806  * @cname('__pyx_memoryview_copy_object')
20807  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
20808  * "Create a new memoryview object"
20809  * cdef __Pyx_memviewslice memviewslice
20810  */
20811 
20812  /* function exit code */
20813  __pyx_L1_error:;
20814  __Pyx_XDECREF(__pyx_t_1);
20815  __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
20816  __pyx_r = 0;
20817  __pyx_L0:;
20818  __Pyx_XGIVEREF(__pyx_r);
20819  __Pyx_TraceReturn(__pyx_r, 0);
20820  __Pyx_RefNannyFinishContext();
20821  return __pyx_r;
20822 }
20823 
20824 /* "View.MemoryView":1089
20825  *
20826  * @cname('__pyx_memoryview_copy_object_from_slice')
20827  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
20828  * """
20829  * Create a new memoryview object from a given memoryview object and slice.
20830  */
20831 
20832 static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
20833  PyObject *(*__pyx_v_to_object_func)(char *);
20834  int (*__pyx_v_to_dtype_func)(char *, PyObject *);
20835  PyObject *__pyx_r = NULL;
20836  __Pyx_TraceDeclarations
20837  __Pyx_RefNannyDeclarations
20838  int __pyx_t_1;
20839  int __pyx_t_2;
20840  PyObject *(*__pyx_t_3)(char *);
20841  int (*__pyx_t_4)(char *, PyObject *);
20842  PyObject *__pyx_t_5 = NULL;
20843  int __pyx_lineno = 0;
20844  const char *__pyx_filename = NULL;
20845  int __pyx_clineno = 0;
20846  __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
20847  __Pyx_TraceCall("memoryview_copy_from_slice", __pyx_f[1], 1089, 0, __PYX_ERR(1, 1089, __pyx_L1_error));
20848 
20849  /* "View.MemoryView":1096
20850  * cdef int (*to_dtype_func)(char *, object) except 0
20851  *
20852  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
20853  * to_object_func = (<_memoryviewslice> memview).to_object_func
20854  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
20855  */
20856  __Pyx_TraceLine(1096,0,__PYX_ERR(1, 1096, __pyx_L1_error))
20857  __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
20858  __pyx_t_2 = (__pyx_t_1 != 0);
20859  if (__pyx_t_2) {
20860 
20861  /* "View.MemoryView":1097
20862  *
20863  * if isinstance(memview, _memoryviewslice):
20864  * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
20865  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
20866  * else:
20867  */
20868  __Pyx_TraceLine(1097,0,__PYX_ERR(1, 1097, __pyx_L1_error))
20869  __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
20870  __pyx_v_to_object_func = __pyx_t_3;
20871 
20872  /* "View.MemoryView":1098
20873  * if isinstance(memview, _memoryviewslice):
20874  * to_object_func = (<_memoryviewslice> memview).to_object_func
20875  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
20876  * else:
20877  * to_object_func = NULL
20878  */
20879  __Pyx_TraceLine(1098,0,__PYX_ERR(1, 1098, __pyx_L1_error))
20880  __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
20881  __pyx_v_to_dtype_func = __pyx_t_4;
20882 
20883  /* "View.MemoryView":1096
20884  * cdef int (*to_dtype_func)(char *, object) except 0
20885  *
20886  * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
20887  * to_object_func = (<_memoryviewslice> memview).to_object_func
20888  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
20889  */
20890  goto __pyx_L3;
20891  }
20892 
20893  /* "View.MemoryView":1100
20894  * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
20895  * else:
20896  * to_object_func = NULL # <<<<<<<<<<<<<<
20897  * to_dtype_func = NULL
20898  *
20899  */
20900  __Pyx_TraceLine(1100,0,__PYX_ERR(1, 1100, __pyx_L1_error))
20901  /*else*/ {
20902  __pyx_v_to_object_func = NULL;
20903 
20904  /* "View.MemoryView":1101
20905  * else:
20906  * to_object_func = NULL
20907  * to_dtype_func = NULL # <<<<<<<<<<<<<<
20908  *
20909  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
20910  */
20911  __Pyx_TraceLine(1101,0,__PYX_ERR(1, 1101, __pyx_L1_error))
20912  __pyx_v_to_dtype_func = NULL;
20913  }
20914  __pyx_L3:;
20915 
20916  /* "View.MemoryView":1103
20917  * to_dtype_func = NULL
20918  *
20919  * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
20920  * to_object_func, to_dtype_func,
20921  * memview.dtype_is_object)
20922  */
20923  __Pyx_TraceLine(1103,0,__PYX_ERR(1, 1103, __pyx_L1_error))
20924  __Pyx_XDECREF(__pyx_r);
20925 
20926  /* "View.MemoryView":1105
20927  * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
20928  * to_object_func, to_dtype_func,
20929  * memview.dtype_is_object) # <<<<<<<<<<<<<<
20930  *
20931  *
20932  */
20933  __Pyx_TraceLine(1105,0,__PYX_ERR(1, 1105, __pyx_L1_error))
20934  __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1103, __pyx_L1_error)
20935  __Pyx_GOTREF(__pyx_t_5);
20936  __pyx_r = __pyx_t_5;
20937  __pyx_t_5 = 0;
20938  goto __pyx_L0;
20939 
20940  /* "View.MemoryView":1089
20941  *
20942  * @cname('__pyx_memoryview_copy_object_from_slice')
20943  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
20944  * """
20945  * Create a new memoryview object from a given memoryview object and slice.
20946  */
20947 
20948  /* function exit code */
20949  __pyx_L1_error:;
20950  __Pyx_XDECREF(__pyx_t_5);
20951  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
20952  __pyx_r = 0;
20953  __pyx_L0:;
20954  __Pyx_XGIVEREF(__pyx_r);
20955  __Pyx_TraceReturn(__pyx_r, 0);
20956  __Pyx_RefNannyFinishContext();
20957  return __pyx_r;
20958 }
20959 
20960 /* "View.MemoryView":1111
20961  *
20962  *
20963  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
20964  * if arg < 0:
20965  * return -arg
20966  */
20967 
20968 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
20969  Py_ssize_t __pyx_r;
20970  __Pyx_TraceDeclarations
20971  int __pyx_t_1;
20972  int __pyx_lineno = 0;
20973  const char *__pyx_filename = NULL;
20974  int __pyx_clineno = 0;
20975  __Pyx_TraceCall("abs_py_ssize_t", __pyx_f[1], 1111, 1, __PYX_ERR(1, 1111, __pyx_L1_error));
20976 
20977  /* "View.MemoryView":1112
20978  *
20979  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
20980  * if arg < 0: # <<<<<<<<<<<<<<
20981  * return -arg
20982  * else:
20983  */
20984  __Pyx_TraceLine(1112,1,__PYX_ERR(1, 1112, __pyx_L1_error))
20985  __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
20986  if (__pyx_t_1) {
20987 
20988  /* "View.MemoryView":1113
20989  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
20990  * if arg < 0:
20991  * return -arg # <<<<<<<<<<<<<<
20992  * else:
20993  * return arg
20994  */
20995  __Pyx_TraceLine(1113,1,__PYX_ERR(1, 1113, __pyx_L1_error))
20996  __pyx_r = (-__pyx_v_arg);
20997  goto __pyx_L0;
20998 
20999  /* "View.MemoryView":1112
21000  *
21001  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
21002  * if arg < 0: # <<<<<<<<<<<<<<
21003  * return -arg
21004  * else:
21005  */
21006  }
21007 
21008  /* "View.MemoryView":1115
21009  * return -arg
21010  * else:
21011  * return arg # <<<<<<<<<<<<<<
21012  *
21013  * @cname('__pyx_get_best_slice_order')
21014  */
21015  __Pyx_TraceLine(1115,1,__PYX_ERR(1, 1115, __pyx_L1_error))
21016  /*else*/ {
21017  __pyx_r = __pyx_v_arg;
21018  goto __pyx_L0;
21019  }
21020 
21021  /* "View.MemoryView":1111
21022  *
21023  *
21024  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
21025  * if arg < 0:
21026  * return -arg
21027  */
21028 
21029  /* function exit code */
21030  __pyx_L1_error:;
21031  __Pyx_WriteUnraisable("View.MemoryView.abs_py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21032  __pyx_r = 0;
21033  __pyx_L0:;
21034  __Pyx_TraceReturn(Py_None, 1);
21035  return __pyx_r;
21036 }
21037 
21038 /* "View.MemoryView":1118
21039  *
21040  * @cname('__pyx_get_best_slice_order')
21041  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
21042  * """
21043  * Figure out the best memory access order for a given slice.
21044  */
21045 
21046 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
21047  int __pyx_v_i;
21048  Py_ssize_t __pyx_v_c_stride;
21049  Py_ssize_t __pyx_v_f_stride;
21050  char __pyx_r;
21051  __Pyx_TraceDeclarations
21052  int __pyx_t_1;
21053  int __pyx_t_2;
21054  int __pyx_t_3;
21055  int __pyx_t_4;
21056  int __pyx_lineno = 0;
21057  const char *__pyx_filename = NULL;
21058  int __pyx_clineno = 0;
21059  __Pyx_TraceCall("get_best_order", __pyx_f[1], 1118, 1, __PYX_ERR(1, 1118, __pyx_L1_error));
21060 
21061  /* "View.MemoryView":1123
21062  * """
21063  * cdef int i
21064  * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
21065  * cdef Py_ssize_t f_stride = 0
21066  *
21067  */
21068  __Pyx_TraceLine(1123,1,__PYX_ERR(1, 1123, __pyx_L1_error))
21069  __pyx_v_c_stride = 0;
21070 
21071  /* "View.MemoryView":1124
21072  * cdef int i
21073  * cdef Py_ssize_t c_stride = 0
21074  * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
21075  *
21076  * for i in range(ndim - 1, -1, -1):
21077  */
21078  __Pyx_TraceLine(1124,1,__PYX_ERR(1, 1124, __pyx_L1_error))
21079  __pyx_v_f_stride = 0;
21080 
21081  /* "View.MemoryView":1126
21082  * cdef Py_ssize_t f_stride = 0
21083  *
21084  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
21085  * if mslice.shape[i] > 1:
21086  * c_stride = mslice.strides[i]
21087  */
21088  __Pyx_TraceLine(1126,1,__PYX_ERR(1, 1126, __pyx_L1_error))
21089  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
21090  __pyx_v_i = __pyx_t_1;
21091 
21092  /* "View.MemoryView":1127
21093  *
21094  * for i in range(ndim - 1, -1, -1):
21095  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
21096  * c_stride = mslice.strides[i]
21097  * break
21098  */
21099  __Pyx_TraceLine(1127,1,__PYX_ERR(1, 1127, __pyx_L1_error))
21100  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
21101  if (__pyx_t_2) {
21102 
21103  /* "View.MemoryView":1128
21104  * for i in range(ndim - 1, -1, -1):
21105  * if mslice.shape[i] > 1:
21106  * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
21107  * break
21108  *
21109  */
21110  __Pyx_TraceLine(1128,1,__PYX_ERR(1, 1128, __pyx_L1_error))
21111  __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
21112 
21113  /* "View.MemoryView":1129
21114  * if mslice.shape[i] > 1:
21115  * c_stride = mslice.strides[i]
21116  * break # <<<<<<<<<<<<<<
21117  *
21118  * for i in range(ndim):
21119  */
21120  __Pyx_TraceLine(1129,1,__PYX_ERR(1, 1129, __pyx_L1_error))
21121  goto __pyx_L4_break;
21122 
21123  /* "View.MemoryView":1127
21124  *
21125  * for i in range(ndim - 1, -1, -1):
21126  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
21127  * c_stride = mslice.strides[i]
21128  * break
21129  */
21130  }
21131  }
21132  __pyx_L4_break:;
21133 
21134  /* "View.MemoryView":1131
21135  * break
21136  *
21137  * for i in range(ndim): # <<<<<<<<<<<<<<
21138  * if mslice.shape[i] > 1:
21139  * f_stride = mslice.strides[i]
21140  */
21141  __Pyx_TraceLine(1131,1,__PYX_ERR(1, 1131, __pyx_L1_error))
21142  __pyx_t_1 = __pyx_v_ndim;
21143  __pyx_t_3 = __pyx_t_1;
21144  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21145  __pyx_v_i = __pyx_t_4;
21146 
21147  /* "View.MemoryView":1132
21148  *
21149  * for i in range(ndim):
21150  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
21151  * f_stride = mslice.strides[i]
21152  * break
21153  */
21154  __Pyx_TraceLine(1132,1,__PYX_ERR(1, 1132, __pyx_L1_error))
21155  __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
21156  if (__pyx_t_2) {
21157 
21158  /* "View.MemoryView":1133
21159  * for i in range(ndim):
21160  * if mslice.shape[i] > 1:
21161  * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
21162  * break
21163  *
21164  */
21165  __Pyx_TraceLine(1133,1,__PYX_ERR(1, 1133, __pyx_L1_error))
21166  __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
21167 
21168  /* "View.MemoryView":1134
21169  * if mslice.shape[i] > 1:
21170  * f_stride = mslice.strides[i]
21171  * break # <<<<<<<<<<<<<<
21172  *
21173  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
21174  */
21175  __Pyx_TraceLine(1134,1,__PYX_ERR(1, 1134, __pyx_L1_error))
21176  goto __pyx_L7_break;
21177 
21178  /* "View.MemoryView":1132
21179  *
21180  * for i in range(ndim):
21181  * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
21182  * f_stride = mslice.strides[i]
21183  * break
21184  */
21185  }
21186  }
21187  __pyx_L7_break:;
21188 
21189  /* "View.MemoryView":1136
21190  * break
21191  *
21192  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
21193  * return 'C'
21194  * else:
21195  */
21196  __Pyx_TraceLine(1136,1,__PYX_ERR(1, 1136, __pyx_L1_error))
21197  __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
21198  if (__pyx_t_2) {
21199 
21200  /* "View.MemoryView":1137
21201  *
21202  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
21203  * return 'C' # <<<<<<<<<<<<<<
21204  * else:
21205  * return 'F'
21206  */
21207  __Pyx_TraceLine(1137,1,__PYX_ERR(1, 1137, __pyx_L1_error))
21208  __pyx_r = 'C';
21209  goto __pyx_L0;
21210 
21211  /* "View.MemoryView":1136
21212  * break
21213  *
21214  * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
21215  * return 'C'
21216  * else:
21217  */
21218  }
21219 
21220  /* "View.MemoryView":1139
21221  * return 'C'
21222  * else:
21223  * return 'F' # <<<<<<<<<<<<<<
21224  *
21225  * @cython.cdivision(True)
21226  */
21227  __Pyx_TraceLine(1139,1,__PYX_ERR(1, 1139, __pyx_L1_error))
21228  /*else*/ {
21229  __pyx_r = 'F';
21230  goto __pyx_L0;
21231  }
21232 
21233  /* "View.MemoryView":1118
21234  *
21235  * @cname('__pyx_get_best_slice_order')
21236  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
21237  * """
21238  * Figure out the best memory access order for a given slice.
21239  */
21240 
21241  /* function exit code */
21242  __pyx_L1_error:;
21243  __Pyx_WriteUnraisable("View.MemoryView.get_best_order", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21244  __pyx_r = 0;
21245  __pyx_L0:;
21246  __Pyx_TraceReturn(Py_None, 1);
21247  return __pyx_r;
21248 }
21249 
21250 /* "View.MemoryView":1142
21251  *
21252  * @cython.cdivision(True)
21253  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
21254  * char *dst_data, Py_ssize_t *dst_strides,
21255  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
21256  */
21257 
21258 static void _copy_strided_to_strided(char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides, char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
21259  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
21260  CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
21261  Py_ssize_t __pyx_v_dst_extent;
21262  Py_ssize_t __pyx_v_src_stride;
21263  Py_ssize_t __pyx_v_dst_stride;
21264  int __pyx_t_1;
21265  int __pyx_t_2;
21266  int __pyx_t_3;
21267  Py_ssize_t __pyx_t_4;
21268  Py_ssize_t __pyx_t_5;
21269  Py_ssize_t __pyx_t_6;
21270 
21271  /* "View.MemoryView":1149
21272  *
21273  * cdef Py_ssize_t i
21274  * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
21275  * cdef Py_ssize_t dst_extent = dst_shape[0]
21276  * cdef Py_ssize_t src_stride = src_strides[0]
21277  */
21278  __pyx_v_src_extent = (__pyx_v_src_shape[0]);
21279 
21280  /* "View.MemoryView":1150
21281  * cdef Py_ssize_t i
21282  * cdef Py_ssize_t src_extent = src_shape[0]
21283  * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
21284  * cdef Py_ssize_t src_stride = src_strides[0]
21285  * cdef Py_ssize_t dst_stride = dst_strides[0]
21286  */
21287  __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
21288 
21289  /* "View.MemoryView":1151
21290  * cdef Py_ssize_t src_extent = src_shape[0]
21291  * cdef Py_ssize_t dst_extent = dst_shape[0]
21292  * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
21293  * cdef Py_ssize_t dst_stride = dst_strides[0]
21294  *
21295  */
21296  __pyx_v_src_stride = (__pyx_v_src_strides[0]);
21297 
21298  /* "View.MemoryView":1152
21299  * cdef Py_ssize_t dst_extent = dst_shape[0]
21300  * cdef Py_ssize_t src_stride = src_strides[0]
21301  * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
21302  *
21303  * if ndim == 1:
21304  */
21305  __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
21306 
21307  /* "View.MemoryView":1154
21308  * cdef Py_ssize_t dst_stride = dst_strides[0]
21309  *
21310  * if ndim == 1: # <<<<<<<<<<<<<<
21311  * if (src_stride > 0 and dst_stride > 0 and
21312  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21313  */
21314  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
21315  if (__pyx_t_1) {
21316 
21317  /* "View.MemoryView":1155
21318  *
21319  * if ndim == 1:
21320  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
21321  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21322  * memcpy(dst_data, src_data, itemsize * dst_extent)
21323  */
21324  __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
21325  if (__pyx_t_2) {
21326  } else {
21327  __pyx_t_1 = __pyx_t_2;
21328  goto __pyx_L5_bool_binop_done;
21329  }
21330  __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
21331  if (__pyx_t_2) {
21332  } else {
21333  __pyx_t_1 = __pyx_t_2;
21334  goto __pyx_L5_bool_binop_done;
21335  }
21336 
21337  /* "View.MemoryView":1156
21338  * if ndim == 1:
21339  * if (src_stride > 0 and dst_stride > 0 and
21340  * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
21341  * memcpy(dst_data, src_data, itemsize * dst_extent)
21342  * else:
21343  */
21344  __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
21345  if (__pyx_t_2) {
21346  __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
21347  }
21348  __pyx_t_3 = (__pyx_t_2 != 0);
21349  __pyx_t_1 = __pyx_t_3;
21350  __pyx_L5_bool_binop_done:;
21351 
21352  /* "View.MemoryView":1155
21353  *
21354  * if ndim == 1:
21355  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
21356  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21357  * memcpy(dst_data, src_data, itemsize * dst_extent)
21358  */
21359  if (__pyx_t_1) {
21360 
21361  /* "View.MemoryView":1157
21362  * if (src_stride > 0 and dst_stride > 0 and
21363  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21364  * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
21365  * else:
21366  * for i in range(dst_extent):
21367  */
21368  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
21369 
21370  /* "View.MemoryView":1155
21371  *
21372  * if ndim == 1:
21373  * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
21374  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21375  * memcpy(dst_data, src_data, itemsize * dst_extent)
21376  */
21377  goto __pyx_L4;
21378  }
21379 
21380  /* "View.MemoryView":1159
21381  * memcpy(dst_data, src_data, itemsize * dst_extent)
21382  * else:
21383  * for i in range(dst_extent): # <<<<<<<<<<<<<<
21384  * memcpy(dst_data, src_data, itemsize)
21385  * src_data += src_stride
21386  */
21387  /*else*/ {
21388  __pyx_t_4 = __pyx_v_dst_extent;
21389  __pyx_t_5 = __pyx_t_4;
21390  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21391  __pyx_v_i = __pyx_t_6;
21392 
21393  /* "View.MemoryView":1160
21394  * else:
21395  * for i in range(dst_extent):
21396  * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
21397  * src_data += src_stride
21398  * dst_data += dst_stride
21399  */
21400  (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
21401 
21402  /* "View.MemoryView":1161
21403  * for i in range(dst_extent):
21404  * memcpy(dst_data, src_data, itemsize)
21405  * src_data += src_stride # <<<<<<<<<<<<<<
21406  * dst_data += dst_stride
21407  * else:
21408  */
21409  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
21410 
21411  /* "View.MemoryView":1162
21412  * memcpy(dst_data, src_data, itemsize)
21413  * src_data += src_stride
21414  * dst_data += dst_stride # <<<<<<<<<<<<<<
21415  * else:
21416  * for i in range(dst_extent):
21417  */
21418  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
21419  }
21420  }
21421  __pyx_L4:;
21422 
21423  /* "View.MemoryView":1154
21424  * cdef Py_ssize_t dst_stride = dst_strides[0]
21425  *
21426  * if ndim == 1: # <<<<<<<<<<<<<<
21427  * if (src_stride > 0 and dst_stride > 0 and
21428  * <size_t> src_stride == itemsize == <size_t> dst_stride):
21429  */
21430  goto __pyx_L3;
21431  }
21432 
21433  /* "View.MemoryView":1164
21434  * dst_data += dst_stride
21435  * else:
21436  * for i in range(dst_extent): # <<<<<<<<<<<<<<
21437  * _copy_strided_to_strided(src_data, src_strides + 1,
21438  * dst_data, dst_strides + 1,
21439  */
21440  /*else*/ {
21441  __pyx_t_4 = __pyx_v_dst_extent;
21442  __pyx_t_5 = __pyx_t_4;
21443  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21444  __pyx_v_i = __pyx_t_6;
21445 
21446  /* "View.MemoryView":1165
21447  * else:
21448  * for i in range(dst_extent):
21449  * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
21450  * dst_data, dst_strides + 1,
21451  * src_shape + 1, dst_shape + 1,
21452  */
21453  _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
21454 
21455  /* "View.MemoryView":1169
21456  * src_shape + 1, dst_shape + 1,
21457  * ndim - 1, itemsize)
21458  * src_data += src_stride # <<<<<<<<<<<<<<
21459  * dst_data += dst_stride
21460  *
21461  */
21462  __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
21463 
21464  /* "View.MemoryView":1170
21465  * ndim - 1, itemsize)
21466  * src_data += src_stride
21467  * dst_data += dst_stride # <<<<<<<<<<<<<<
21468  *
21469  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
21470  */
21471  __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
21472  }
21473  }
21474  __pyx_L3:;
21475 
21476  /* "View.MemoryView":1142
21477  *
21478  * @cython.cdivision(True)
21479  * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
21480  * char *dst_data, Py_ssize_t *dst_strides,
21481  * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
21482  */
21483 
21484  /* function exit code */
21485 }
21486 
21487 /* "View.MemoryView":1172
21488  * dst_data += dst_stride
21489  *
21490  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
21491  * __Pyx_memviewslice *dst,
21492  * int ndim, size_t itemsize) nogil:
21493  */
21494 
21495 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize) {
21496  __Pyx_TraceDeclarations
21497  int __pyx_lineno = 0;
21498  const char *__pyx_filename = NULL;
21499  int __pyx_clineno = 0;
21500  __Pyx_TraceCall("copy_strided_to_strided", __pyx_f[1], 1172, 1, __PYX_ERR(1, 1172, __pyx_L1_error));
21501 
21502  /* "View.MemoryView":1175
21503  * __Pyx_memviewslice *dst,
21504  * int ndim, size_t itemsize) nogil:
21505  * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
21506  * src.shape, dst.shape, ndim, itemsize)
21507  *
21508  */
21509  __Pyx_TraceLine(1175,1,__PYX_ERR(1, 1175, __pyx_L1_error))
21510  _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
21511 
21512  /* "View.MemoryView":1172
21513  * dst_data += dst_stride
21514  *
21515  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
21516  * __Pyx_memviewslice *dst,
21517  * int ndim, size_t itemsize) nogil:
21518  */
21519 
21520  /* function exit code */
21521  goto __pyx_L0;
21522  __pyx_L1_error:;
21523  __Pyx_WriteUnraisable("View.MemoryView.copy_strided_to_strided", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21524  __pyx_L0:;
21525  __Pyx_TraceReturn(Py_None, 1);
21526 }
21527 
21528 /* "View.MemoryView":1179
21529  *
21530  * @cname('__pyx_memoryview_slice_get_size')
21531  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
21532  * "Return the size of the memory occupied by the slice in number of bytes"
21533  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
21534  */
21535 
21536 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
21537  Py_ssize_t __pyx_v_shape;
21538  Py_ssize_t __pyx_v_size;
21539  Py_ssize_t __pyx_r;
21540  __Pyx_TraceDeclarations
21541  Py_ssize_t __pyx_t_1;
21542  Py_ssize_t *__pyx_t_2;
21543  Py_ssize_t *__pyx_t_3;
21544  Py_ssize_t *__pyx_t_4;
21545  int __pyx_lineno = 0;
21546  const char *__pyx_filename = NULL;
21547  int __pyx_clineno = 0;
21548  __Pyx_TraceCall("slice_get_size", __pyx_f[1], 1179, 1, __PYX_ERR(1, 1179, __pyx_L1_error));
21549 
21550  /* "View.MemoryView":1181
21551  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
21552  * "Return the size of the memory occupied by the slice in number of bytes"
21553  * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
21554  *
21555  * for shape in src.shape[:ndim]:
21556  */
21557  __Pyx_TraceLine(1181,1,__PYX_ERR(1, 1181, __pyx_L1_error))
21558  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
21559  __pyx_v_size = __pyx_t_1;
21560 
21561  /* "View.MemoryView":1183
21562  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
21563  *
21564  * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
21565  * size *= shape
21566  *
21567  */
21568  __Pyx_TraceLine(1183,1,__PYX_ERR(1, 1183, __pyx_L1_error))
21569  __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
21570  for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
21571  __pyx_t_2 = __pyx_t_4;
21572  __pyx_v_shape = (__pyx_t_2[0]);
21573 
21574  /* "View.MemoryView":1184
21575  *
21576  * for shape in src.shape[:ndim]:
21577  * size *= shape # <<<<<<<<<<<<<<
21578  *
21579  * return size
21580  */
21581  __Pyx_TraceLine(1184,1,__PYX_ERR(1, 1184, __pyx_L1_error))
21582  __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
21583  }
21584 
21585  /* "View.MemoryView":1186
21586  * size *= shape
21587  *
21588  * return size # <<<<<<<<<<<<<<
21589  *
21590  * @cname('__pyx_fill_contig_strides_array')
21591  */
21592  __Pyx_TraceLine(1186,1,__PYX_ERR(1, 1186, __pyx_L1_error))
21593  __pyx_r = __pyx_v_size;
21594  goto __pyx_L0;
21595 
21596  /* "View.MemoryView":1179
21597  *
21598  * @cname('__pyx_memoryview_slice_get_size')
21599  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
21600  * "Return the size of the memory occupied by the slice in number of bytes"
21601  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
21602  */
21603 
21604  /* function exit code */
21605  __pyx_L1_error:;
21606  __Pyx_WriteUnraisable("View.MemoryView.slice_get_size", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21607  __pyx_r = 0;
21608  __pyx_L0:;
21609  __Pyx_TraceReturn(Py_None, 1);
21610  return __pyx_r;
21611 }
21612 
21613 /* "View.MemoryView":1189
21614  *
21615  * @cname('__pyx_fill_contig_strides_array')
21616  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
21617  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
21618  * int ndim, char order) nogil:
21619  */
21620 
21621 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride, int __pyx_v_ndim, char __pyx_v_order) {
21622  int __pyx_v_idx;
21623  Py_ssize_t __pyx_r;
21624  __Pyx_TraceDeclarations
21625  int __pyx_t_1;
21626  int __pyx_t_2;
21627  int __pyx_t_3;
21628  int __pyx_t_4;
21629  int __pyx_lineno = 0;
21630  const char *__pyx_filename = NULL;
21631  int __pyx_clineno = 0;
21632  __Pyx_TraceCall("fill_contig_strides_array", __pyx_f[1], 1189, 1, __PYX_ERR(1, 1189, __pyx_L1_error));
21633 
21634  /* "View.MemoryView":1198
21635  * cdef int idx
21636  *
21637  * if order == 'F': # <<<<<<<<<<<<<<
21638  * for idx in range(ndim):
21639  * strides[idx] = stride
21640  */
21641  __Pyx_TraceLine(1198,1,__PYX_ERR(1, 1198, __pyx_L1_error))
21642  __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
21643  if (__pyx_t_1) {
21644 
21645  /* "View.MemoryView":1199
21646  *
21647  * if order == 'F':
21648  * for idx in range(ndim): # <<<<<<<<<<<<<<
21649  * strides[idx] = stride
21650  * stride *= shape[idx]
21651  */
21652  __Pyx_TraceLine(1199,1,__PYX_ERR(1, 1199, __pyx_L1_error))
21653  __pyx_t_2 = __pyx_v_ndim;
21654  __pyx_t_3 = __pyx_t_2;
21655  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
21656  __pyx_v_idx = __pyx_t_4;
21657 
21658  /* "View.MemoryView":1200
21659  * if order == 'F':
21660  * for idx in range(ndim):
21661  * strides[idx] = stride # <<<<<<<<<<<<<<
21662  * stride *= shape[idx]
21663  * else:
21664  */
21665  __Pyx_TraceLine(1200,1,__PYX_ERR(1, 1200, __pyx_L1_error))
21666  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
21667 
21668  /* "View.MemoryView":1201
21669  * for idx in range(ndim):
21670  * strides[idx] = stride
21671  * stride *= shape[idx] # <<<<<<<<<<<<<<
21672  * else:
21673  * for idx in range(ndim - 1, -1, -1):
21674  */
21675  __Pyx_TraceLine(1201,1,__PYX_ERR(1, 1201, __pyx_L1_error))
21676  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
21677  }
21678 
21679  /* "View.MemoryView":1198
21680  * cdef int idx
21681  *
21682  * if order == 'F': # <<<<<<<<<<<<<<
21683  * for idx in range(ndim):
21684  * strides[idx] = stride
21685  */
21686  goto __pyx_L3;
21687  }
21688 
21689  /* "View.MemoryView":1203
21690  * stride *= shape[idx]
21691  * else:
21692  * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
21693  * strides[idx] = stride
21694  * stride *= shape[idx]
21695  */
21696  __Pyx_TraceLine(1203,1,__PYX_ERR(1, 1203, __pyx_L1_error))
21697  /*else*/ {
21698  for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
21699  __pyx_v_idx = __pyx_t_2;
21700 
21701  /* "View.MemoryView":1204
21702  * else:
21703  * for idx in range(ndim - 1, -1, -1):
21704  * strides[idx] = stride # <<<<<<<<<<<<<<
21705  * stride *= shape[idx]
21706  *
21707  */
21708  __Pyx_TraceLine(1204,1,__PYX_ERR(1, 1204, __pyx_L1_error))
21709  (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
21710 
21711  /* "View.MemoryView":1205
21712  * for idx in range(ndim - 1, -1, -1):
21713  * strides[idx] = stride
21714  * stride *= shape[idx] # <<<<<<<<<<<<<<
21715  *
21716  * return stride
21717  */
21718  __Pyx_TraceLine(1205,1,__PYX_ERR(1, 1205, __pyx_L1_error))
21719  __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
21720  }
21721  }
21722  __pyx_L3:;
21723 
21724  /* "View.MemoryView":1207
21725  * stride *= shape[idx]
21726  *
21727  * return stride # <<<<<<<<<<<<<<
21728  *
21729  * @cname('__pyx_memoryview_copy_data_to_temp')
21730  */
21731  __Pyx_TraceLine(1207,1,__PYX_ERR(1, 1207, __pyx_L1_error))
21732  __pyx_r = __pyx_v_stride;
21733  goto __pyx_L0;
21734 
21735  /* "View.MemoryView":1189
21736  *
21737  * @cname('__pyx_fill_contig_strides_array')
21738  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
21739  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
21740  * int ndim, char order) nogil:
21741  */
21742 
21743  /* function exit code */
21744  __pyx_L1_error:;
21745  __Pyx_WriteUnraisable("View.MemoryView.fill_contig_strides_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
21746  __pyx_r = 0;
21747  __pyx_L0:;
21748  __Pyx_TraceReturn(Py_None, 1);
21749  return __pyx_r;
21750 }
21751 
21752 /* "View.MemoryView":1210
21753  *
21754  * @cname('__pyx_memoryview_copy_data_to_temp')
21755  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
21756  * __Pyx_memviewslice *tmpslice,
21757  * char order,
21758  */
21759 
21760 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice, char __pyx_v_order, int __pyx_v_ndim) {
21761  int __pyx_v_i;
21762  void *__pyx_v_result;
21763  size_t __pyx_v_itemsize;
21764  size_t __pyx_v_size;
21765  void *__pyx_r;
21766  __Pyx_TraceDeclarations
21767  Py_ssize_t __pyx_t_1;
21768  int __pyx_t_2;
21769  int __pyx_t_3;
21770  struct __pyx_memoryview_obj *__pyx_t_4;
21771  int __pyx_t_5;
21772  int __pyx_t_6;
21773  int __pyx_lineno = 0;
21774  const char *__pyx_filename = NULL;
21775  int __pyx_clineno = 0;
21776  __Pyx_TraceCall("copy_data_to_temp", __pyx_f[1], 1210, 1, __PYX_ERR(1, 1210, __pyx_L1_error));
21777 
21778  /* "View.MemoryView":1221
21779  * cdef void *result
21780  *
21781  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
21782  * cdef size_t size = slice_get_size(src, ndim)
21783  *
21784  */
21785  __Pyx_TraceLine(1221,1,__PYX_ERR(1, 1221, __pyx_L1_error))
21786  __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
21787  __pyx_v_itemsize = __pyx_t_1;
21788 
21789  /* "View.MemoryView":1222
21790  *
21791  * cdef size_t itemsize = src.memview.view.itemsize
21792  * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
21793  *
21794  * result = malloc(size)
21795  */
21796  __Pyx_TraceLine(1222,1,__PYX_ERR(1, 1222, __pyx_L1_error))
21797  __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
21798 
21799  /* "View.MemoryView":1224
21800  * cdef size_t size = slice_get_size(src, ndim)
21801  *
21802  * result = malloc(size) # <<<<<<<<<<<<<<
21803  * if not result:
21804  * _err(MemoryError, NULL)
21805  */
21806  __Pyx_TraceLine(1224,1,__PYX_ERR(1, 1224, __pyx_L1_error))
21807  __pyx_v_result = malloc(__pyx_v_size);
21808 
21809  /* "View.MemoryView":1225
21810  *
21811  * result = malloc(size)
21812  * if not result: # <<<<<<<<<<<<<<
21813  * _err(MemoryError, NULL)
21814  *
21815  */
21816  __Pyx_TraceLine(1225,1,__PYX_ERR(1, 1225, __pyx_L1_error))
21817  __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
21818  if (__pyx_t_2) {
21819 
21820  /* "View.MemoryView":1226
21821  * result = malloc(size)
21822  * if not result:
21823  * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
21824  *
21825  *
21826  */
21827  __Pyx_TraceLine(1226,1,__PYX_ERR(1, 1226, __pyx_L1_error))
21828  __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 1226, __pyx_L1_error)
21829 
21830  /* "View.MemoryView":1225
21831  *
21832  * result = malloc(size)
21833  * if not result: # <<<<<<<<<<<<<<
21834  * _err(MemoryError, NULL)
21835  *
21836  */
21837  }
21838 
21839  /* "View.MemoryView":1229
21840  *
21841  *
21842  * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
21843  * tmpslice.memview = src.memview
21844  * for i in range(ndim):
21845  */
21846  __Pyx_TraceLine(1229,1,__PYX_ERR(1, 1229, __pyx_L1_error))
21847  __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
21848 
21849  /* "View.MemoryView":1230
21850  *
21851  * tmpslice.data = <char *> result
21852  * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
21853  * for i in range(ndim):
21854  * tmpslice.shape[i] = src.shape[i]
21855  */
21856  __Pyx_TraceLine(1230,1,__PYX_ERR(1, 1230, __pyx_L1_error))
21857  __pyx_t_4 = __pyx_v_src->memview;
21858  __pyx_v_tmpslice->memview = __pyx_t_4;
21859 
21860  /* "View.MemoryView":1231
21861  * tmpslice.data = <char *> result
21862  * tmpslice.memview = src.memview
21863  * for i in range(ndim): # <<<<<<<<<<<<<<
21864  * tmpslice.shape[i] = src.shape[i]
21865  * tmpslice.suboffsets[i] = -1
21866  */
21867  __Pyx_TraceLine(1231,1,__PYX_ERR(1, 1231, __pyx_L1_error))
21868  __pyx_t_3 = __pyx_v_ndim;
21869  __pyx_t_5 = __pyx_t_3;
21870  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21871  __pyx_v_i = __pyx_t_6;
21872 
21873  /* "View.MemoryView":1232
21874  * tmpslice.memview = src.memview
21875  * for i in range(ndim):
21876  * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
21877  * tmpslice.suboffsets[i] = -1
21878  *
21879  */
21880  __Pyx_TraceLine(1232,1,__PYX_ERR(1, 1232, __pyx_L1_error))
21881  (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
21882 
21883  /* "View.MemoryView":1233
21884  * for i in range(ndim):
21885  * tmpslice.shape[i] = src.shape[i]
21886  * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
21887  *
21888  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
21889  */
21890  __Pyx_TraceLine(1233,1,__PYX_ERR(1, 1233, __pyx_L1_error))
21891  (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
21892  }
21893 
21894  /* "View.MemoryView":1235
21895  * tmpslice.suboffsets[i] = -1
21896  *
21897  * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
21898  * ndim, order)
21899  *
21900  */
21901  __Pyx_TraceLine(1235,1,__PYX_ERR(1, 1235, __pyx_L1_error))
21902  (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
21903 
21904  /* "View.MemoryView":1239
21905  *
21906  *
21907  * for i in range(ndim): # <<<<<<<<<<<<<<
21908  * if tmpslice.shape[i] == 1:
21909  * tmpslice.strides[i] = 0
21910  */
21911  __Pyx_TraceLine(1239,1,__PYX_ERR(1, 1239, __pyx_L1_error))
21912  __pyx_t_3 = __pyx_v_ndim;
21913  __pyx_t_5 = __pyx_t_3;
21914  for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
21915  __pyx_v_i = __pyx_t_6;
21916 
21917  /* "View.MemoryView":1240
21918  *
21919  * for i in range(ndim):
21920  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
21921  * tmpslice.strides[i] = 0
21922  *
21923  */
21924  __Pyx_TraceLine(1240,1,__PYX_ERR(1, 1240, __pyx_L1_error))
21925  __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
21926  if (__pyx_t_2) {
21927 
21928  /* "View.MemoryView":1241
21929  * for i in range(ndim):
21930  * if tmpslice.shape[i] == 1:
21931  * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
21932  *
21933  * if slice_is_contig(src[0], order, ndim):
21934  */
21935  __Pyx_TraceLine(1241,1,__PYX_ERR(1, 1241, __pyx_L1_error))
21936  (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
21937 
21938  /* "View.MemoryView":1240
21939  *
21940  * for i in range(ndim):
21941  * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
21942  * tmpslice.strides[i] = 0
21943  *
21944  */
21945  }
21946  }
21947 
21948  /* "View.MemoryView":1243
21949  * tmpslice.strides[i] = 0
21950  *
21951  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
21952  * memcpy(result, src.data, size)
21953  * else:
21954  */
21955  __Pyx_TraceLine(1243,1,__PYX_ERR(1, 1243, __pyx_L1_error))
21956  __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
21957  if (__pyx_t_2) {
21958 
21959  /* "View.MemoryView":1244
21960  *
21961  * if slice_is_contig(src[0], order, ndim):
21962  * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
21963  * else:
21964  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
21965  */
21966  __Pyx_TraceLine(1244,1,__PYX_ERR(1, 1244, __pyx_L1_error))
21967  (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
21968 
21969  /* "View.MemoryView":1243
21970  * tmpslice.strides[i] = 0
21971  *
21972  * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
21973  * memcpy(result, src.data, size)
21974  * else:
21975  */
21976  goto __pyx_L9;
21977  }
21978 
21979  /* "View.MemoryView":1246
21980  * memcpy(result, src.data, size)
21981  * else:
21982  * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
21983  *
21984  * return result
21985  */
21986  __Pyx_TraceLine(1246,1,__PYX_ERR(1, 1246, __pyx_L1_error))
21987  /*else*/ {
21988  copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
21989  }
21990  __pyx_L9:;
21991 
21992  /* "View.MemoryView":1248
21993  * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
21994  *
21995  * return result # <<<<<<<<<<<<<<
21996  *
21997  *
21998  */
21999  __Pyx_TraceLine(1248,1,__PYX_ERR(1, 1248, __pyx_L1_error))
22000  __pyx_r = __pyx_v_result;
22001  goto __pyx_L0;
22002 
22003  /* "View.MemoryView":1210
22004  *
22005  * @cname('__pyx_memoryview_copy_data_to_temp')
22006  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
22007  * __Pyx_memviewslice *tmpslice,
22008  * char order,
22009  */
22010 
22011  /* function exit code */
22012  __pyx_L1_error:;
22013  {
22014  #ifdef WITH_THREAD
22015  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22016  #endif
22017  __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
22018  #ifdef WITH_THREAD
22019  __Pyx_PyGILState_Release(__pyx_gilstate_save);
22020  #endif
22021  }
22022  __pyx_r = NULL;
22023  __pyx_L0:;
22024  __Pyx_TraceReturn(Py_None, 1);
22025  return __pyx_r;
22026 }
22027 
22028 /* "View.MemoryView":1253
22029  *
22030  * @cname('__pyx_memoryview_err_extents')
22031  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
22032  * Py_ssize_t extent2) except -1 with gil:
22033  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
22034  */
22035 
22036 static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
22037  int __pyx_r;
22038  __Pyx_TraceDeclarations
22039  __Pyx_RefNannyDeclarations
22040  PyObject *__pyx_t_1 = NULL;
22041  PyObject *__pyx_t_2 = NULL;
22042  PyObject *__pyx_t_3 = NULL;
22043  PyObject *__pyx_t_4 = NULL;
22044  int __pyx_lineno = 0;
22045  const char *__pyx_filename = NULL;
22046  int __pyx_clineno = 0;
22047  #ifdef WITH_THREAD
22048  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22049  #endif
22050  __Pyx_RefNannySetupContext("_err_extents", 0);
22051  __Pyx_TraceCall("_err_extents", __pyx_f[1], 1253, 0, __PYX_ERR(1, 1253, __pyx_L1_error));
22052 
22053  /* "View.MemoryView":1256
22054  * Py_ssize_t extent2) except -1 with gil:
22055  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
22056  * (i, extent1, extent2)) # <<<<<<<<<<<<<<
22057  *
22058  * @cname('__pyx_memoryview_err_dim')
22059  */
22060  __Pyx_TraceLine(1256,0,__PYX_ERR(1, 1256, __pyx_L1_error))
22061  __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1256, __pyx_L1_error)
22062  __Pyx_GOTREF(__pyx_t_1);
22063  __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1256, __pyx_L1_error)
22064  __Pyx_GOTREF(__pyx_t_2);
22065  __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1256, __pyx_L1_error)
22066  __Pyx_GOTREF(__pyx_t_3);
22067  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1256, __pyx_L1_error)
22068  __Pyx_GOTREF(__pyx_t_4);
22069  __Pyx_GIVEREF(__pyx_t_1);
22070  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
22071  __Pyx_GIVEREF(__pyx_t_2);
22072  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
22073  __Pyx_GIVEREF(__pyx_t_3);
22074  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
22075  __pyx_t_1 = 0;
22076  __pyx_t_2 = 0;
22077  __pyx_t_3 = 0;
22078 
22079  /* "View.MemoryView":1255
22080  * cdef int _err_extents(int i, Py_ssize_t extent1,
22081  * Py_ssize_t extent2) except -1 with gil:
22082  * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
22083  * (i, extent1, extent2))
22084  *
22085  */
22086  __Pyx_TraceLine(1255,0,__PYX_ERR(1, 1255, __pyx_L1_error))
22087  __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1255, __pyx_L1_error)
22088  __Pyx_GOTREF(__pyx_t_3);
22089  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22090  __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1255, __pyx_L1_error)
22091  __Pyx_GOTREF(__pyx_t_4);
22092  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22093  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
22094  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22095  __PYX_ERR(1, 1255, __pyx_L1_error)
22096 
22097  /* "View.MemoryView":1253
22098  *
22099  * @cname('__pyx_memoryview_err_extents')
22100  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
22101  * Py_ssize_t extent2) except -1 with gil:
22102  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
22103  */
22104 
22105  /* function exit code */
22106  __pyx_L1_error:;
22107  __Pyx_XDECREF(__pyx_t_1);
22108  __Pyx_XDECREF(__pyx_t_2);
22109  __Pyx_XDECREF(__pyx_t_3);
22110  __Pyx_XDECREF(__pyx_t_4);
22111  __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
22112  __pyx_r = -1;
22113  __Pyx_TraceReturn(Py_None, 0);
22114  __Pyx_RefNannyFinishContext();
22115  #ifdef WITH_THREAD
22116  __Pyx_PyGILState_Release(__pyx_gilstate_save);
22117  #endif
22118  return __pyx_r;
22119 }
22120 
22121 /* "View.MemoryView":1259
22122  *
22123  * @cname('__pyx_memoryview_err_dim')
22124  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
22125  * raise error(msg.decode('ascii') % dim)
22126  *
22127  */
22128 
22129 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
22130  int __pyx_r;
22131  __Pyx_TraceDeclarations
22132  __Pyx_RefNannyDeclarations
22133  PyObject *__pyx_t_1 = NULL;
22134  PyObject *__pyx_t_2 = NULL;
22135  PyObject *__pyx_t_3 = NULL;
22136  PyObject *__pyx_t_4 = NULL;
22137  int __pyx_lineno = 0;
22138  const char *__pyx_filename = NULL;
22139  int __pyx_clineno = 0;
22140  #ifdef WITH_THREAD
22141  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22142  #endif
22143  __Pyx_RefNannySetupContext("_err_dim", 0);
22144  __Pyx_TraceCall("_err_dim", __pyx_f[1], 1259, 0, __PYX_ERR(1, 1259, __pyx_L1_error));
22145  __Pyx_INCREF(__pyx_v_error);
22146 
22147  /* "View.MemoryView":1260
22148  * @cname('__pyx_memoryview_err_dim')
22149  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
22150  * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
22151  *
22152  * @cname('__pyx_memoryview_err')
22153  */
22154  __Pyx_TraceLine(1260,0,__PYX_ERR(1, 1260, __pyx_L1_error))
22155  __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1260, __pyx_L1_error)
22156  __Pyx_GOTREF(__pyx_t_2);
22157  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1260, __pyx_L1_error)
22158  __Pyx_GOTREF(__pyx_t_3);
22159  __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1260, __pyx_L1_error)
22160  __Pyx_GOTREF(__pyx_t_4);
22161  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22162  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22163  __Pyx_INCREF(__pyx_v_error);
22164  __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
22165  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
22166  __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
22167  if (likely(__pyx_t_2)) {
22168  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
22169  __Pyx_INCREF(__pyx_t_2);
22170  __Pyx_INCREF(function);
22171  __Pyx_DECREF_SET(__pyx_t_3, function);
22172  }
22173  }
22174  __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
22175  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
22176  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22177  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1260, __pyx_L1_error)
22178  __Pyx_GOTREF(__pyx_t_1);
22179  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22180  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
22181  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22182  __PYX_ERR(1, 1260, __pyx_L1_error)
22183 
22184  /* "View.MemoryView":1259
22185  *
22186  * @cname('__pyx_memoryview_err_dim')
22187  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
22188  * raise error(msg.decode('ascii') % dim)
22189  *
22190  */
22191 
22192  /* function exit code */
22193  __pyx_L1_error:;
22194  __Pyx_XDECREF(__pyx_t_1);
22195  __Pyx_XDECREF(__pyx_t_2);
22196  __Pyx_XDECREF(__pyx_t_3);
22197  __Pyx_XDECREF(__pyx_t_4);
22198  __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
22199  __pyx_r = -1;
22200  __Pyx_XDECREF(__pyx_v_error);
22201  __Pyx_TraceReturn(Py_None, 0);
22202  __Pyx_RefNannyFinishContext();
22203  #ifdef WITH_THREAD
22204  __Pyx_PyGILState_Release(__pyx_gilstate_save);
22205  #endif
22206  return __pyx_r;
22207 }
22208 
22209 /* "View.MemoryView":1263
22210  *
22211  * @cname('__pyx_memoryview_err')
22212  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
22213  * if msg != NULL:
22214  * raise error(msg.decode('ascii'))
22215  */
22216 
22217 static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
22218  int __pyx_r;
22219  __Pyx_TraceDeclarations
22220  __Pyx_RefNannyDeclarations
22221  int __pyx_t_1;
22222  PyObject *__pyx_t_2 = NULL;
22223  PyObject *__pyx_t_3 = NULL;
22224  PyObject *__pyx_t_4 = NULL;
22225  PyObject *__pyx_t_5 = NULL;
22226  int __pyx_lineno = 0;
22227  const char *__pyx_filename = NULL;
22228  int __pyx_clineno = 0;
22229  #ifdef WITH_THREAD
22230  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22231  #endif
22232  __Pyx_RefNannySetupContext("_err", 0);
22233  __Pyx_TraceCall("_err", __pyx_f[1], 1263, 0, __PYX_ERR(1, 1263, __pyx_L1_error));
22234  __Pyx_INCREF(__pyx_v_error);
22235 
22236  /* "View.MemoryView":1264
22237  * @cname('__pyx_memoryview_err')
22238  * cdef int _err(object error, char *msg) except -1 with gil:
22239  * if msg != NULL: # <<<<<<<<<<<<<<
22240  * raise error(msg.decode('ascii'))
22241  * else:
22242  */
22243  __Pyx_TraceLine(1264,0,__PYX_ERR(1, 1264, __pyx_L1_error))
22244  __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
22245  if (unlikely(__pyx_t_1)) {
22246 
22247  /* "View.MemoryView":1265
22248  * cdef int _err(object error, char *msg) except -1 with gil:
22249  * if msg != NULL:
22250  * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
22251  * else:
22252  * raise error
22253  */
22254  __Pyx_TraceLine(1265,0,__PYX_ERR(1, 1265, __pyx_L1_error))
22255  __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1265, __pyx_L1_error)
22256  __Pyx_GOTREF(__pyx_t_3);
22257  __Pyx_INCREF(__pyx_v_error);
22258  __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
22259  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
22260  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
22261  if (likely(__pyx_t_5)) {
22262  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
22263  __Pyx_INCREF(__pyx_t_5);
22264  __Pyx_INCREF(function);
22265  __Pyx_DECREF_SET(__pyx_t_4, function);
22266  }
22267  }
22268  __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
22269  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
22270  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
22271  if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1265, __pyx_L1_error)
22272  __Pyx_GOTREF(__pyx_t_2);
22273  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
22274  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
22275  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
22276  __PYX_ERR(1, 1265, __pyx_L1_error)
22277 
22278  /* "View.MemoryView":1264
22279  * @cname('__pyx_memoryview_err')
22280  * cdef int _err(object error, char *msg) except -1 with gil:
22281  * if msg != NULL: # <<<<<<<<<<<<<<
22282  * raise error(msg.decode('ascii'))
22283  * else:
22284  */
22285  }
22286 
22287  /* "View.MemoryView":1267
22288  * raise error(msg.decode('ascii'))
22289  * else:
22290  * raise error # <<<<<<<<<<<<<<
22291  *
22292  * @cname('__pyx_memoryview_copy_contents')
22293  */
22294  __Pyx_TraceLine(1267,0,__PYX_ERR(1, 1267, __pyx_L1_error))
22295  /*else*/ {
22296  __Pyx_Raise(__pyx_v_error, 0, 0, 0);
22297  __PYX_ERR(1, 1267, __pyx_L1_error)
22298  }
22299 
22300  /* "View.MemoryView":1263
22301  *
22302  * @cname('__pyx_memoryview_err')
22303  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
22304  * if msg != NULL:
22305  * raise error(msg.decode('ascii'))
22306  */
22307 
22308  /* function exit code */
22309  __pyx_L1_error:;
22310  __Pyx_XDECREF(__pyx_t_2);
22311  __Pyx_XDECREF(__pyx_t_3);
22312  __Pyx_XDECREF(__pyx_t_4);
22313  __Pyx_XDECREF(__pyx_t_5);
22314  __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
22315  __pyx_r = -1;
22316  __Pyx_XDECREF(__pyx_v_error);
22317  __Pyx_TraceReturn(Py_None, 0);
22318  __Pyx_RefNannyFinishContext();
22319  #ifdef WITH_THREAD
22320  __Pyx_PyGILState_Release(__pyx_gilstate_save);
22321  #endif
22322  return __pyx_r;
22323 }
22324 
22325 /* "View.MemoryView":1270
22326  *
22327  * @cname('__pyx_memoryview_copy_contents')
22328  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
22329  * __Pyx_memviewslice dst,
22330  * int src_ndim, int dst_ndim,
22331  */
22332 
22333 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst, int __pyx_v_src_ndim, int __pyx_v_dst_ndim, int __pyx_v_dtype_is_object) {
22334  void *__pyx_v_tmpdata;
22335  size_t __pyx_v_itemsize;
22336  int __pyx_v_i;
22337  char __pyx_v_order;
22338  int __pyx_v_broadcasting;
22339  int __pyx_v_direct_copy;
22340  __Pyx_memviewslice __pyx_v_tmp;
22341  int __pyx_v_ndim;
22342  int __pyx_r;
22343  __Pyx_TraceDeclarations
22344  Py_ssize_t __pyx_t_1;
22345  int __pyx_t_2;
22346  int __pyx_t_3;
22347  int __pyx_t_4;
22348  int __pyx_t_5;
22349  int __pyx_t_6;
22350  void *__pyx_t_7;
22351  int __pyx_t_8;
22352  int __pyx_lineno = 0;
22353  const char *__pyx_filename = NULL;
22354  int __pyx_clineno = 0;
22355  __Pyx_TraceCall("memoryview_copy_contents", __pyx_f[1], 1270, 1, __PYX_ERR(1, 1270, __pyx_L1_error));
22356 
22357  /* "View.MemoryView":1278
22358  * Check for overlapping memory and verify the shapes.
22359  * """
22360  * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
22361  * cdef size_t itemsize = src.memview.view.itemsize
22362  * cdef int i
22363  */
22364  __Pyx_TraceLine(1278,1,__PYX_ERR(1, 1278, __pyx_L1_error))
22365  __pyx_v_tmpdata = NULL;
22366 
22367  /* "View.MemoryView":1279
22368  * """
22369  * cdef void *tmpdata = NULL
22370  * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
22371  * cdef int i
22372  * cdef char order = get_best_order(&src, src_ndim)
22373  */
22374  __Pyx_TraceLine(1279,1,__PYX_ERR(1, 1279, __pyx_L1_error))
22375  __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
22376  __pyx_v_itemsize = __pyx_t_1;
22377 
22378  /* "View.MemoryView":1281
22379  * cdef size_t itemsize = src.memview.view.itemsize
22380  * cdef int i
22381  * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
22382  * cdef bint broadcasting = False
22383  * cdef bint direct_copy = False
22384  */
22385  __Pyx_TraceLine(1281,1,__PYX_ERR(1, 1281, __pyx_L1_error))
22386  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
22387 
22388  /* "View.MemoryView":1282
22389  * cdef int i
22390  * cdef char order = get_best_order(&src, src_ndim)
22391  * cdef bint broadcasting = False # <<<<<<<<<<<<<<
22392  * cdef bint direct_copy = False
22393  * cdef __Pyx_memviewslice tmp
22394  */
22395  __Pyx_TraceLine(1282,1,__PYX_ERR(1, 1282, __pyx_L1_error))
22396  __pyx_v_broadcasting = 0;
22397 
22398  /* "View.MemoryView":1283
22399  * cdef char order = get_best_order(&src, src_ndim)
22400  * cdef bint broadcasting = False
22401  * cdef bint direct_copy = False # <<<<<<<<<<<<<<
22402  * cdef __Pyx_memviewslice tmp
22403  *
22404  */
22405  __Pyx_TraceLine(1283,1,__PYX_ERR(1, 1283, __pyx_L1_error))
22406  __pyx_v_direct_copy = 0;
22407 
22408  /* "View.MemoryView":1286
22409  * cdef __Pyx_memviewslice tmp
22410  *
22411  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
22412  * broadcast_leading(&src, src_ndim, dst_ndim)
22413  * elif dst_ndim < src_ndim:
22414  */
22415  __Pyx_TraceLine(1286,1,__PYX_ERR(1, 1286, __pyx_L1_error))
22416  __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
22417  if (__pyx_t_2) {
22418 
22419  /* "View.MemoryView":1287
22420  *
22421  * if src_ndim < dst_ndim:
22422  * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
22423  * elif dst_ndim < src_ndim:
22424  * broadcast_leading(&dst, dst_ndim, src_ndim)
22425  */
22426  __Pyx_TraceLine(1287,1,__PYX_ERR(1, 1287, __pyx_L1_error))
22427  __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
22428 
22429  /* "View.MemoryView":1286
22430  * cdef __Pyx_memviewslice tmp
22431  *
22432  * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
22433  * broadcast_leading(&src, src_ndim, dst_ndim)
22434  * elif dst_ndim < src_ndim:
22435  */
22436  goto __pyx_L3;
22437  }
22438 
22439  /* "View.MemoryView":1288
22440  * if src_ndim < dst_ndim:
22441  * broadcast_leading(&src, src_ndim, dst_ndim)
22442  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
22443  * broadcast_leading(&dst, dst_ndim, src_ndim)
22444  *
22445  */
22446  __Pyx_TraceLine(1288,1,__PYX_ERR(1, 1288, __pyx_L1_error))
22447  __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
22448  if (__pyx_t_2) {
22449 
22450  /* "View.MemoryView":1289
22451  * broadcast_leading(&src, src_ndim, dst_ndim)
22452  * elif dst_ndim < src_ndim:
22453  * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
22454  *
22455  * cdef int ndim = max(src_ndim, dst_ndim)
22456  */
22457  __Pyx_TraceLine(1289,1,__PYX_ERR(1, 1289, __pyx_L1_error))
22458  __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
22459 
22460  /* "View.MemoryView":1288
22461  * if src_ndim < dst_ndim:
22462  * broadcast_leading(&src, src_ndim, dst_ndim)
22463  * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
22464  * broadcast_leading(&dst, dst_ndim, src_ndim)
22465  *
22466  */
22467  }
22468  __pyx_L3:;
22469 
22470  /* "View.MemoryView":1291
22471  * broadcast_leading(&dst, dst_ndim, src_ndim)
22472  *
22473  * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
22474  *
22475  * for i in range(ndim):
22476  */
22477  __Pyx_TraceLine(1291,1,__PYX_ERR(1, 1291, __pyx_L1_error))
22478  __pyx_t_3 = __pyx_v_dst_ndim;
22479  __pyx_t_4 = __pyx_v_src_ndim;
22480  if (((__pyx_t_3 > __pyx_t_4) != 0)) {
22481  __pyx_t_5 = __pyx_t_3;
22482  } else {
22483  __pyx_t_5 = __pyx_t_4;
22484  }
22485  __pyx_v_ndim = __pyx_t_5;
22486 
22487  /* "View.MemoryView":1293
22488  * cdef int ndim = max(src_ndim, dst_ndim)
22489  *
22490  * for i in range(ndim): # <<<<<<<<<<<<<<
22491  * if src.shape[i] != dst.shape[i]:
22492  * if src.shape[i] == 1:
22493  */
22494  __Pyx_TraceLine(1293,1,__PYX_ERR(1, 1293, __pyx_L1_error))
22495  __pyx_t_5 = __pyx_v_ndim;
22496  __pyx_t_3 = __pyx_t_5;
22497  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
22498  __pyx_v_i = __pyx_t_4;
22499 
22500  /* "View.MemoryView":1294
22501  *
22502  * for i in range(ndim):
22503  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
22504  * if src.shape[i] == 1:
22505  * broadcasting = True
22506  */
22507  __Pyx_TraceLine(1294,1,__PYX_ERR(1, 1294, __pyx_L1_error))
22508  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
22509  if (__pyx_t_2) {
22510 
22511  /* "View.MemoryView":1295
22512  * for i in range(ndim):
22513  * if src.shape[i] != dst.shape[i]:
22514  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
22515  * broadcasting = True
22516  * src.strides[i] = 0
22517  */
22518  __Pyx_TraceLine(1295,1,__PYX_ERR(1, 1295, __pyx_L1_error))
22519  __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
22520  if (__pyx_t_2) {
22521 
22522  /* "View.MemoryView":1296
22523  * if src.shape[i] != dst.shape[i]:
22524  * if src.shape[i] == 1:
22525  * broadcasting = True # <<<<<<<<<<<<<<
22526  * src.strides[i] = 0
22527  * else:
22528  */
22529  __Pyx_TraceLine(1296,1,__PYX_ERR(1, 1296, __pyx_L1_error))
22530  __pyx_v_broadcasting = 1;
22531 
22532  /* "View.MemoryView":1297
22533  * if src.shape[i] == 1:
22534  * broadcasting = True
22535  * src.strides[i] = 0 # <<<<<<<<<<<<<<
22536  * else:
22537  * _err_extents(i, dst.shape[i], src.shape[i])
22538  */
22539  __Pyx_TraceLine(1297,1,__PYX_ERR(1, 1297, __pyx_L1_error))
22540  (__pyx_v_src.strides[__pyx_v_i]) = 0;
22541 
22542  /* "View.MemoryView":1295
22543  * for i in range(ndim):
22544  * if src.shape[i] != dst.shape[i]:
22545  * if src.shape[i] == 1: # <<<<<<<<<<<<<<
22546  * broadcasting = True
22547  * src.strides[i] = 0
22548  */
22549  goto __pyx_L7;
22550  }
22551 
22552  /* "View.MemoryView":1299
22553  * src.strides[i] = 0
22554  * else:
22555  * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
22556  *
22557  * if src.suboffsets[i] >= 0:
22558  */
22559  __Pyx_TraceLine(1299,1,__PYX_ERR(1, 1299, __pyx_L1_error))
22560  /*else*/ {
22561  __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i])); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1299, __pyx_L1_error)
22562  }
22563  __pyx_L7:;
22564 
22565  /* "View.MemoryView":1294
22566  *
22567  * for i in range(ndim):
22568  * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
22569  * if src.shape[i] == 1:
22570  * broadcasting = True
22571  */
22572  }
22573 
22574  /* "View.MemoryView":1301
22575  * _err_extents(i, dst.shape[i], src.shape[i])
22576  *
22577  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
22578  * _err_dim(ValueError, "Dimension %d is not direct", i)
22579  *
22580  */
22581  __Pyx_TraceLine(1301,1,__PYX_ERR(1, 1301, __pyx_L1_error))
22582  __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
22583  if (__pyx_t_2) {
22584 
22585  /* "View.MemoryView":1302
22586  *
22587  * if src.suboffsets[i] >= 0:
22588  * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
22589  *
22590  * if slices_overlap(&src, &dst, ndim, itemsize):
22591  */
22592  __Pyx_TraceLine(1302,1,__PYX_ERR(1, 1302, __pyx_L1_error))
22593  __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((char *)"Dimension %d is not direct"), __pyx_v_i); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(1, 1302, __pyx_L1_error)
22594 
22595  /* "View.MemoryView":1301
22596  * _err_extents(i, dst.shape[i], src.shape[i])
22597  *
22598  * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
22599  * _err_dim(ValueError, "Dimension %d is not direct", i)
22600  *
22601  */
22602  }
22603  }
22604 
22605  /* "View.MemoryView":1304
22606  * _err_dim(ValueError, "Dimension %d is not direct", i)
22607  *
22608  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
22609  *
22610  * if not slice_is_contig(src, order, ndim):
22611  */
22612  __Pyx_TraceLine(1304,1,__PYX_ERR(1, 1304, __pyx_L1_error))
22613  __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
22614  if (__pyx_t_2) {
22615 
22616  /* "View.MemoryView":1306
22617  * if slices_overlap(&src, &dst, ndim, itemsize):
22618  *
22619  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
22620  * order = get_best_order(&dst, ndim)
22621  *
22622  */
22623  __Pyx_TraceLine(1306,1,__PYX_ERR(1, 1306, __pyx_L1_error))
22624  __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
22625  if (__pyx_t_2) {
22626 
22627  /* "View.MemoryView":1307
22628  *
22629  * if not slice_is_contig(src, order, ndim):
22630  * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
22631  *
22632  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
22633  */
22634  __Pyx_TraceLine(1307,1,__PYX_ERR(1, 1307, __pyx_L1_error))
22635  __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
22636 
22637  /* "View.MemoryView":1306
22638  * if slices_overlap(&src, &dst, ndim, itemsize):
22639  *
22640  * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
22641  * order = get_best_order(&dst, ndim)
22642  *
22643  */
22644  }
22645 
22646  /* "View.MemoryView":1309
22647  * order = get_best_order(&dst, ndim)
22648  *
22649  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
22650  * src = tmp
22651  *
22652  */
22653  __Pyx_TraceLine(1309,1,__PYX_ERR(1, 1309, __pyx_L1_error))
22654  __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim); if (unlikely(__pyx_t_7 == ((void *)NULL))) __PYX_ERR(1, 1309, __pyx_L1_error)
22655  __pyx_v_tmpdata = __pyx_t_7;
22656 
22657  /* "View.MemoryView":1310
22658  *
22659  * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
22660  * src = tmp # <<<<<<<<<<<<<<
22661  *
22662  * if not broadcasting:
22663  */
22664  __Pyx_TraceLine(1310,1,__PYX_ERR(1, 1310, __pyx_L1_error))
22665  __pyx_v_src = __pyx_v_tmp;
22666 
22667  /* "View.MemoryView":1304
22668  * _err_dim(ValueError, "Dimension %d is not direct", i)
22669  *
22670  * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
22671  *
22672  * if not slice_is_contig(src, order, ndim):
22673  */
22674  }
22675 
22676  /* "View.MemoryView":1312
22677  * src = tmp
22678  *
22679  * if not broadcasting: # <<<<<<<<<<<<<<
22680  *
22681  *
22682  */
22683  __Pyx_TraceLine(1312,1,__PYX_ERR(1, 1312, __pyx_L1_error))
22684  __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
22685  if (__pyx_t_2) {
22686 
22687  /* "View.MemoryView":1315
22688  *
22689  *
22690  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
22691  * direct_copy = slice_is_contig(dst, 'C', ndim)
22692  * elif slice_is_contig(src, 'F', ndim):
22693  */
22694  __Pyx_TraceLine(1315,1,__PYX_ERR(1, 1315, __pyx_L1_error))
22695  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
22696  if (__pyx_t_2) {
22697 
22698  /* "View.MemoryView":1316
22699  *
22700  * if slice_is_contig(src, 'C', ndim):
22701  * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
22702  * elif slice_is_contig(src, 'F', ndim):
22703  * direct_copy = slice_is_contig(dst, 'F', ndim)
22704  */
22705  __Pyx_TraceLine(1316,1,__PYX_ERR(1, 1316, __pyx_L1_error))
22706  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
22707 
22708  /* "View.MemoryView":1315
22709  *
22710  *
22711  * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
22712  * direct_copy = slice_is_contig(dst, 'C', ndim)
22713  * elif slice_is_contig(src, 'F', ndim):
22714  */
22715  goto __pyx_L12;
22716  }
22717 
22718  /* "View.MemoryView":1317
22719  * if slice_is_contig(src, 'C', ndim):
22720  * direct_copy = slice_is_contig(dst, 'C', ndim)
22721  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
22722  * direct_copy = slice_is_contig(dst, 'F', ndim)
22723  *
22724  */
22725  __Pyx_TraceLine(1317,1,__PYX_ERR(1, 1317, __pyx_L1_error))
22726  __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
22727  if (__pyx_t_2) {
22728 
22729  /* "View.MemoryView":1318
22730  * direct_copy = slice_is_contig(dst, 'C', ndim)
22731  * elif slice_is_contig(src, 'F', ndim):
22732  * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
22733  *
22734  * if direct_copy:
22735  */
22736  __Pyx_TraceLine(1318,1,__PYX_ERR(1, 1318, __pyx_L1_error))
22737  __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
22738 
22739  /* "View.MemoryView":1317
22740  * if slice_is_contig(src, 'C', ndim):
22741  * direct_copy = slice_is_contig(dst, 'C', ndim)
22742  * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
22743  * direct_copy = slice_is_contig(dst, 'F', ndim)
22744  *
22745  */
22746  }
22747  __pyx_L12:;
22748 
22749  /* "View.MemoryView":1320
22750  * direct_copy = slice_is_contig(dst, 'F', ndim)
22751  *
22752  * if direct_copy: # <<<<<<<<<<<<<<
22753  *
22754  * refcount_copying(&dst, dtype_is_object, ndim, False)
22755  */
22756  __Pyx_TraceLine(1320,1,__PYX_ERR(1, 1320, __pyx_L1_error))
22757  __pyx_t_2 = (__pyx_v_direct_copy != 0);
22758  if (__pyx_t_2) {
22759 
22760  /* "View.MemoryView":1322
22761  * if direct_copy:
22762  *
22763  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
22764  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
22765  * refcount_copying(&dst, dtype_is_object, ndim, True)
22766  */
22767  __Pyx_TraceLine(1322,1,__PYX_ERR(1, 1322, __pyx_L1_error))
22768  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
22769 
22770  /* "View.MemoryView":1323
22771  *
22772  * refcount_copying(&dst, dtype_is_object, ndim, False)
22773  * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
22774  * refcount_copying(&dst, dtype_is_object, ndim, True)
22775  * free(tmpdata)
22776  */
22777  __Pyx_TraceLine(1323,1,__PYX_ERR(1, 1323, __pyx_L1_error))
22778  (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
22779 
22780  /* "View.MemoryView":1324
22781  * refcount_copying(&dst, dtype_is_object, ndim, False)
22782  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
22783  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
22784  * free(tmpdata)
22785  * return 0
22786  */
22787  __Pyx_TraceLine(1324,1,__PYX_ERR(1, 1324, __pyx_L1_error))
22788  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
22789 
22790  /* "View.MemoryView":1325
22791  * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
22792  * refcount_copying(&dst, dtype_is_object, ndim, True)
22793  * free(tmpdata) # <<<<<<<<<<<<<<
22794  * return 0
22795  *
22796  */
22797  __Pyx_TraceLine(1325,1,__PYX_ERR(1, 1325, __pyx_L1_error))
22798  free(__pyx_v_tmpdata);
22799 
22800  /* "View.MemoryView":1326
22801  * refcount_copying(&dst, dtype_is_object, ndim, True)
22802  * free(tmpdata)
22803  * return 0 # <<<<<<<<<<<<<<
22804  *
22805  * if order == 'F' == get_best_order(&dst, ndim):
22806  */
22807  __Pyx_TraceLine(1326,1,__PYX_ERR(1, 1326, __pyx_L1_error))
22808  __pyx_r = 0;
22809  goto __pyx_L0;
22810 
22811  /* "View.MemoryView":1320
22812  * direct_copy = slice_is_contig(dst, 'F', ndim)
22813  *
22814  * if direct_copy: # <<<<<<<<<<<<<<
22815  *
22816  * refcount_copying(&dst, dtype_is_object, ndim, False)
22817  */
22818  }
22819 
22820  /* "View.MemoryView":1312
22821  * src = tmp
22822  *
22823  * if not broadcasting: # <<<<<<<<<<<<<<
22824  *
22825  *
22826  */
22827  }
22828 
22829  /* "View.MemoryView":1328
22830  * return 0
22831  *
22832  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
22833  *
22834  *
22835  */
22836  __Pyx_TraceLine(1328,1,__PYX_ERR(1, 1328, __pyx_L1_error))
22837  __pyx_t_2 = (__pyx_v_order == 'F');
22838  if (__pyx_t_2) {
22839  __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
22840  }
22841  __pyx_t_8 = (__pyx_t_2 != 0);
22842  if (__pyx_t_8) {
22843 
22844  /* "View.MemoryView":1331
22845  *
22846  *
22847  * transpose_memslice(&src) # <<<<<<<<<<<<<<
22848  * transpose_memslice(&dst)
22849  *
22850  */
22851  __Pyx_TraceLine(1331,1,__PYX_ERR(1, 1331, __pyx_L1_error))
22852  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1331, __pyx_L1_error)
22853 
22854  /* "View.MemoryView":1332
22855  *
22856  * transpose_memslice(&src)
22857  * transpose_memslice(&dst) # <<<<<<<<<<<<<<
22858  *
22859  * refcount_copying(&dst, dtype_is_object, ndim, False)
22860  */
22861  __Pyx_TraceLine(1332,1,__PYX_ERR(1, 1332, __pyx_L1_error))
22862  __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(1, 1332, __pyx_L1_error)
22863 
22864  /* "View.MemoryView":1328
22865  * return 0
22866  *
22867  * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
22868  *
22869  *
22870  */
22871  }
22872 
22873  /* "View.MemoryView":1334
22874  * transpose_memslice(&dst)
22875  *
22876  * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
22877  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
22878  * refcount_copying(&dst, dtype_is_object, ndim, True)
22879  */
22880  __Pyx_TraceLine(1334,1,__PYX_ERR(1, 1334, __pyx_L1_error))
22881  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
22882 
22883  /* "View.MemoryView":1335
22884  *
22885  * refcount_copying(&dst, dtype_is_object, ndim, False)
22886  * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
22887  * refcount_copying(&dst, dtype_is_object, ndim, True)
22888  *
22889  */
22890  __Pyx_TraceLine(1335,1,__PYX_ERR(1, 1335, __pyx_L1_error))
22891  copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
22892 
22893  /* "View.MemoryView":1336
22894  * refcount_copying(&dst, dtype_is_object, ndim, False)
22895  * copy_strided_to_strided(&src, &dst, ndim, itemsize)
22896  * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
22897  *
22898  * free(tmpdata)
22899  */
22900  __Pyx_TraceLine(1336,1,__PYX_ERR(1, 1336, __pyx_L1_error))
22901  __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
22902 
22903  /* "View.MemoryView":1338
22904  * refcount_copying(&dst, dtype_is_object, ndim, True)
22905  *
22906  * free(tmpdata) # <<<<<<<<<<<<<<
22907  * return 0
22908  *
22909  */
22910  __Pyx_TraceLine(1338,1,__PYX_ERR(1, 1338, __pyx_L1_error))
22911  free(__pyx_v_tmpdata);
22912 
22913  /* "View.MemoryView":1339
22914  *
22915  * free(tmpdata)
22916  * return 0 # <<<<<<<<<<<<<<
22917  *
22918  * @cname('__pyx_memoryview_broadcast_leading')
22919  */
22920  __Pyx_TraceLine(1339,1,__PYX_ERR(1, 1339, __pyx_L1_error))
22921  __pyx_r = 0;
22922  goto __pyx_L0;
22923 
22924  /* "View.MemoryView":1270
22925  *
22926  * @cname('__pyx_memoryview_copy_contents')
22927  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
22928  * __Pyx_memviewslice dst,
22929  * int src_ndim, int dst_ndim,
22930  */
22931 
22932  /* function exit code */
22933  __pyx_L1_error:;
22934  {
22935  #ifdef WITH_THREAD
22936  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
22937  #endif
22938  __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
22939  #ifdef WITH_THREAD
22940  __Pyx_PyGILState_Release(__pyx_gilstate_save);
22941  #endif
22942  }
22943  __pyx_r = -1;
22944  __pyx_L0:;
22945  __Pyx_TraceReturn(Py_None, 1);
22946  return __pyx_r;
22947 }
22948 
22949 /* "View.MemoryView":1342
22950  *
22951  * @cname('__pyx_memoryview_broadcast_leading')
22952  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
22953  * int ndim,
22954  * int ndim_other) nogil:
22955  */
22956 
22957 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
22958  int __pyx_v_i;
22959  int __pyx_v_offset;
22960  __Pyx_TraceDeclarations
22961  int __pyx_t_1;
22962  int __pyx_t_2;
22963  int __pyx_t_3;
22964  int __pyx_lineno = 0;
22965  const char *__pyx_filename = NULL;
22966  int __pyx_clineno = 0;
22967  __Pyx_TraceCall("broadcast_leading", __pyx_f[1], 1342, 1, __PYX_ERR(1, 1342, __pyx_L1_error));
22968 
22969  /* "View.MemoryView":1346
22970  * int ndim_other) nogil:
22971  * cdef int i
22972  * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
22973  *
22974  * for i in range(ndim - 1, -1, -1):
22975  */
22976  __Pyx_TraceLine(1346,1,__PYX_ERR(1, 1346, __pyx_L1_error))
22977  __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
22978 
22979  /* "View.MemoryView":1348
22980  * cdef int offset = ndim_other - ndim
22981  *
22982  * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
22983  * mslice.shape[i + offset] = mslice.shape[i]
22984  * mslice.strides[i + offset] = mslice.strides[i]
22985  */
22986  __Pyx_TraceLine(1348,1,__PYX_ERR(1, 1348, __pyx_L1_error))
22987  for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
22988  __pyx_v_i = __pyx_t_1;
22989 
22990  /* "View.MemoryView":1349
22991  *
22992  * for i in range(ndim - 1, -1, -1):
22993  * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
22994  * mslice.strides[i + offset] = mslice.strides[i]
22995  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
22996  */
22997  __Pyx_TraceLine(1349,1,__PYX_ERR(1, 1349, __pyx_L1_error))
22998  (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
22999 
23000  /* "View.MemoryView":1350
23001  * for i in range(ndim - 1, -1, -1):
23002  * mslice.shape[i + offset] = mslice.shape[i]
23003  * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
23004  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
23005  *
23006  */
23007  __Pyx_TraceLine(1350,1,__PYX_ERR(1, 1350, __pyx_L1_error))
23008  (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
23009 
23010  /* "View.MemoryView":1351
23011  * mslice.shape[i + offset] = mslice.shape[i]
23012  * mslice.strides[i + offset] = mslice.strides[i]
23013  * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
23014  *
23015  * for i in range(offset):
23016  */
23017  __Pyx_TraceLine(1351,1,__PYX_ERR(1, 1351, __pyx_L1_error))
23018  (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
23019  }
23020 
23021  /* "View.MemoryView":1353
23022  * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
23023  *
23024  * for i in range(offset): # <<<<<<<<<<<<<<
23025  * mslice.shape[i] = 1
23026  * mslice.strides[i] = mslice.strides[0]
23027  */
23028  __Pyx_TraceLine(1353,1,__PYX_ERR(1, 1353, __pyx_L1_error))
23029  __pyx_t_1 = __pyx_v_offset;
23030  __pyx_t_2 = __pyx_t_1;
23031  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
23032  __pyx_v_i = __pyx_t_3;
23033 
23034  /* "View.MemoryView":1354
23035  *
23036  * for i in range(offset):
23037  * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
23038  * mslice.strides[i] = mslice.strides[0]
23039  * mslice.suboffsets[i] = -1
23040  */
23041  __Pyx_TraceLine(1354,1,__PYX_ERR(1, 1354, __pyx_L1_error))
23042  (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
23043 
23044  /* "View.MemoryView":1355
23045  * for i in range(offset):
23046  * mslice.shape[i] = 1
23047  * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
23048  * mslice.suboffsets[i] = -1
23049  *
23050  */
23051  __Pyx_TraceLine(1355,1,__PYX_ERR(1, 1355, __pyx_L1_error))
23052  (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
23053 
23054  /* "View.MemoryView":1356
23055  * mslice.shape[i] = 1
23056  * mslice.strides[i] = mslice.strides[0]
23057  * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
23058  *
23059  *
23060  */
23061  __Pyx_TraceLine(1356,1,__PYX_ERR(1, 1356, __pyx_L1_error))
23062  (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
23063  }
23064 
23065  /* "View.MemoryView":1342
23066  *
23067  * @cname('__pyx_memoryview_broadcast_leading')
23068  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
23069  * int ndim,
23070  * int ndim_other) nogil:
23071  */
23072 
23073  /* function exit code */
23074  goto __pyx_L0;
23075  __pyx_L1_error:;
23076  __Pyx_WriteUnraisable("View.MemoryView.broadcast_leading", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23077  __pyx_L0:;
23078  __Pyx_TraceReturn(Py_None, 1);
23079 }
23080 
23081 /* "View.MemoryView":1364
23082  *
23083  * @cname('__pyx_memoryview_refcount_copying')
23084  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
23085  * int ndim, bint inc) nogil:
23086  *
23087  */
23088 
23089 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_dtype_is_object, int __pyx_v_ndim, int __pyx_v_inc) {
23090  __Pyx_TraceDeclarations
23091  int __pyx_t_1;
23092  int __pyx_lineno = 0;
23093  const char *__pyx_filename = NULL;
23094  int __pyx_clineno = 0;
23095  __Pyx_TraceCall("refcount_copying", __pyx_f[1], 1364, 1, __PYX_ERR(1, 1364, __pyx_L1_error));
23096 
23097  /* "View.MemoryView":1368
23098  *
23099  *
23100  * if dtype_is_object: # <<<<<<<<<<<<<<
23101  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
23102  * dst.strides, ndim, inc)
23103  */
23104  __Pyx_TraceLine(1368,1,__PYX_ERR(1, 1368, __pyx_L1_error))
23105  __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
23106  if (__pyx_t_1) {
23107 
23108  /* "View.MemoryView":1369
23109  *
23110  * if dtype_is_object:
23111  * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
23112  * dst.strides, ndim, inc)
23113  *
23114  */
23115  __Pyx_TraceLine(1369,1,__PYX_ERR(1, 1369, __pyx_L1_error))
23116  __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
23117 
23118  /* "View.MemoryView":1368
23119  *
23120  *
23121  * if dtype_is_object: # <<<<<<<<<<<<<<
23122  * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
23123  * dst.strides, ndim, inc)
23124  */
23125  }
23126 
23127  /* "View.MemoryView":1364
23128  *
23129  * @cname('__pyx_memoryview_refcount_copying')
23130  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
23131  * int ndim, bint inc) nogil:
23132  *
23133  */
23134 
23135  /* function exit code */
23136  goto __pyx_L0;
23137  __pyx_L1_error:;
23138  __Pyx_WriteUnraisable("View.MemoryView.refcount_copying", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23139  __pyx_L0:;
23140  __Pyx_TraceReturn(Py_None, 1);
23141 }
23142 
23143 /* "View.MemoryView":1373
23144  *
23145  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
23146  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23147  * Py_ssize_t *strides, int ndim,
23148  * bint inc) with gil:
23149  */
23150 
23151 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
23152  __Pyx_TraceDeclarations
23153  __Pyx_RefNannyDeclarations
23154  int __pyx_lineno = 0;
23155  const char *__pyx_filename = NULL;
23156  int __pyx_clineno = 0;
23157  #ifdef WITH_THREAD
23158  PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
23159  #endif
23160  __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
23161  __Pyx_TraceCall("refcount_objects_in_slice_with_gil", __pyx_f[1], 1373, 0, __PYX_ERR(1, 1373, __pyx_L1_error));
23162 
23163  /* "View.MemoryView":1376
23164  * Py_ssize_t *strides, int ndim,
23165  * bint inc) with gil:
23166  * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
23167  *
23168  * @cname('__pyx_memoryview_refcount_objects_in_slice')
23169  */
23170  __Pyx_TraceLine(1376,0,__PYX_ERR(1, 1376, __pyx_L1_error))
23171  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
23172 
23173  /* "View.MemoryView":1373
23174  *
23175  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
23176  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23177  * Py_ssize_t *strides, int ndim,
23178  * bint inc) with gil:
23179  */
23180 
23181  /* function exit code */
23182  goto __pyx_L0;
23183  __pyx_L1_error:;
23184  __Pyx_WriteUnraisable("View.MemoryView.refcount_objects_in_slice_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23185  __pyx_L0:;
23186  __Pyx_TraceReturn(Py_None, 0);
23187  __Pyx_RefNannyFinishContext();
23188  #ifdef WITH_THREAD
23189  __Pyx_PyGILState_Release(__pyx_gilstate_save);
23190  #endif
23191 }
23192 
23193 /* "View.MemoryView":1379
23194  *
23195  * @cname('__pyx_memoryview_refcount_objects_in_slice')
23196  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23197  * Py_ssize_t *strides, int ndim, bint inc):
23198  * cdef Py_ssize_t i
23199  */
23200 
23201 static void __pyx_memoryview_refcount_objects_in_slice(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, int __pyx_v_inc) {
23202  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
23203  __Pyx_TraceDeclarations
23204  __Pyx_RefNannyDeclarations
23205  Py_ssize_t __pyx_t_1;
23206  Py_ssize_t __pyx_t_2;
23207  Py_ssize_t __pyx_t_3;
23208  int __pyx_t_4;
23209  int __pyx_lineno = 0;
23210  const char *__pyx_filename = NULL;
23211  int __pyx_clineno = 0;
23212  __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
23213  __Pyx_TraceCall("refcount_objects_in_slice", __pyx_f[1], 1379, 0, __PYX_ERR(1, 1379, __pyx_L1_error));
23214 
23215  /* "View.MemoryView":1383
23216  * cdef Py_ssize_t i
23217  *
23218  * for i in range(shape[0]): # <<<<<<<<<<<<<<
23219  * if ndim == 1:
23220  * if inc:
23221  */
23222  __Pyx_TraceLine(1383,0,__PYX_ERR(1, 1383, __pyx_L1_error))
23223  __pyx_t_1 = (__pyx_v_shape[0]);
23224  __pyx_t_2 = __pyx_t_1;
23225  for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
23226  __pyx_v_i = __pyx_t_3;
23227 
23228  /* "View.MemoryView":1384
23229  *
23230  * for i in range(shape[0]):
23231  * if ndim == 1: # <<<<<<<<<<<<<<
23232  * if inc:
23233  * Py_INCREF((<PyObject **> data)[0])
23234  */
23235  __Pyx_TraceLine(1384,0,__PYX_ERR(1, 1384, __pyx_L1_error))
23236  __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
23237  if (__pyx_t_4) {
23238 
23239  /* "View.MemoryView":1385
23240  * for i in range(shape[0]):
23241  * if ndim == 1:
23242  * if inc: # <<<<<<<<<<<<<<
23243  * Py_INCREF((<PyObject **> data)[0])
23244  * else:
23245  */
23246  __Pyx_TraceLine(1385,0,__PYX_ERR(1, 1385, __pyx_L1_error))
23247  __pyx_t_4 = (__pyx_v_inc != 0);
23248  if (__pyx_t_4) {
23249 
23250  /* "View.MemoryView":1386
23251  * if ndim == 1:
23252  * if inc:
23253  * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
23254  * else:
23255  * Py_DECREF((<PyObject **> data)[0])
23256  */
23257  __Pyx_TraceLine(1386,0,__PYX_ERR(1, 1386, __pyx_L1_error))
23258  Py_INCREF((((PyObject **)__pyx_v_data)[0]));
23259 
23260  /* "View.MemoryView":1385
23261  * for i in range(shape[0]):
23262  * if ndim == 1:
23263  * if inc: # <<<<<<<<<<<<<<
23264  * Py_INCREF((<PyObject **> data)[0])
23265  * else:
23266  */
23267  goto __pyx_L6;
23268  }
23269 
23270  /* "View.MemoryView":1388
23271  * Py_INCREF((<PyObject **> data)[0])
23272  * else:
23273  * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
23274  * else:
23275  * refcount_objects_in_slice(data, shape + 1, strides + 1,
23276  */
23277  __Pyx_TraceLine(1388,0,__PYX_ERR(1, 1388, __pyx_L1_error))
23278  /*else*/ {
23279  Py_DECREF((((PyObject **)__pyx_v_data)[0]));
23280  }
23281  __pyx_L6:;
23282 
23283  /* "View.MemoryView":1384
23284  *
23285  * for i in range(shape[0]):
23286  * if ndim == 1: # <<<<<<<<<<<<<<
23287  * if inc:
23288  * Py_INCREF((<PyObject **> data)[0])
23289  */
23290  goto __pyx_L5;
23291  }
23292 
23293  /* "View.MemoryView":1390
23294  * Py_DECREF((<PyObject **> data)[0])
23295  * else:
23296  * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
23297  * ndim - 1, inc)
23298  *
23299  */
23300  __Pyx_TraceLine(1390,0,__PYX_ERR(1, 1390, __pyx_L1_error))
23301  /*else*/ {
23302 
23303  /* "View.MemoryView":1391
23304  * else:
23305  * refcount_objects_in_slice(data, shape + 1, strides + 1,
23306  * ndim - 1, inc) # <<<<<<<<<<<<<<
23307  *
23308  * data += strides[0]
23309  */
23310  __Pyx_TraceLine(1391,0,__PYX_ERR(1, 1391, __pyx_L1_error))
23311  __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
23312  }
23313  __pyx_L5:;
23314 
23315  /* "View.MemoryView":1393
23316  * ndim - 1, inc)
23317  *
23318  * data += strides[0] # <<<<<<<<<<<<<<
23319  *
23320  *
23321  */
23322  __Pyx_TraceLine(1393,0,__PYX_ERR(1, 1393, __pyx_L1_error))
23323  __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
23324  }
23325 
23326  /* "View.MemoryView":1379
23327  *
23328  * @cname('__pyx_memoryview_refcount_objects_in_slice')
23329  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23330  * Py_ssize_t *strides, int ndim, bint inc):
23331  * cdef Py_ssize_t i
23332  */
23333 
23334  /* function exit code */
23335  goto __pyx_L0;
23336  __pyx_L1_error:;
23337  __Pyx_WriteUnraisable("View.MemoryView.refcount_objects_in_slice", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
23338  __pyx_L0:;
23339  __Pyx_TraceReturn(Py_None, 0);
23340  __Pyx_RefNannyFinishContext();
23341 }
23342 
23343 /* "View.MemoryView":1399
23344  *
23345  * @cname('__pyx_memoryview_slice_assign_scalar')
23346  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
23347  * size_t itemsize, void *item,
23348  * bint dtype_is_object) nogil:
23349  */
23350 
23351 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item, int __pyx_v_dtype_is_object) {
23352  __Pyx_TraceDeclarations
23353  int __pyx_lineno = 0;
23354  const char *__pyx_filename = NULL;
23355  int __pyx_clineno = 0;
23356  __Pyx_TraceCall("slice_assign_scalar", __pyx_f[1], 1399, 1, __PYX_ERR(1, 1399, __pyx_L1_error));
23357 
23358  /* "View.MemoryView":1402
23359  * size_t itemsize, void *item,
23360  * bint dtype_is_object) nogil:
23361  * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
23362  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
23363  * itemsize, item)
23364  */
23365  __Pyx_TraceLine(1402,1,__PYX_ERR(1, 1402, __pyx_L1_error))
23366  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
23367 
23368  /* "View.MemoryView":1403
23369  * bint dtype_is_object) nogil:
23370  * refcount_copying(dst, dtype_is_object, ndim, False)
23371  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
23372  * itemsize, item)
23373  * refcount_copying(dst, dtype_is_object, ndim, True)
23374  */
23375  __Pyx_TraceLine(1403,1,__PYX_ERR(1, 1403, __pyx_L1_error))
23376  __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
23377 
23378  /* "View.MemoryView":1405
23379  * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
23380  * itemsize, item)
23381  * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
23382  *
23383  *
23384  */
23385  __Pyx_TraceLine(1405,1,__PYX_ERR(1, 1405, __pyx_L1_error))
23386  __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
23387 
23388  /* "View.MemoryView":1399
23389  *
23390  * @cname('__pyx_memoryview_slice_assign_scalar')
23391  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
23392  * size_t itemsize, void *item,
23393  * bint dtype_is_object) nogil:
23394  */
23395 
23396  /* function exit code */
23397  goto __pyx_L0;
23398  __pyx_L1_error:;
23399  __Pyx_WriteUnraisable("View.MemoryView.slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23400  __pyx_L0:;
23401  __Pyx_TraceReturn(Py_None, 1);
23402 }
23403 
23404 /* "View.MemoryView":1409
23405  *
23406  * @cname('__pyx_memoryview__slice_assign_scalar')
23407  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23408  * Py_ssize_t *strides, int ndim,
23409  * size_t itemsize, void *item) nogil:
23410  */
23411 
23412 static void __pyx_memoryview__slice_assign_scalar(char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, int __pyx_v_ndim, size_t __pyx_v_itemsize, void *__pyx_v_item) {
23413  CYTHON_UNUSED Py_ssize_t __pyx_v_i;
23414  Py_ssize_t __pyx_v_stride;
23415  Py_ssize_t __pyx_v_extent;
23416  __Pyx_TraceDeclarations
23417  int __pyx_t_1;
23418  Py_ssize_t __pyx_t_2;
23419  Py_ssize_t __pyx_t_3;
23420  Py_ssize_t __pyx_t_4;
23421  int __pyx_lineno = 0;
23422  const char *__pyx_filename = NULL;
23423  int __pyx_clineno = 0;
23424  __Pyx_TraceCall("_slice_assign_scalar", __pyx_f[1], 1409, 1, __PYX_ERR(1, 1409, __pyx_L1_error));
23425 
23426  /* "View.MemoryView":1413
23427  * size_t itemsize, void *item) nogil:
23428  * cdef Py_ssize_t i
23429  * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
23430  * cdef Py_ssize_t extent = shape[0]
23431  *
23432  */
23433  __Pyx_TraceLine(1413,1,__PYX_ERR(1, 1413, __pyx_L1_error))
23434  __pyx_v_stride = (__pyx_v_strides[0]);
23435 
23436  /* "View.MemoryView":1414
23437  * cdef Py_ssize_t i
23438  * cdef Py_ssize_t stride = strides[0]
23439  * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
23440  *
23441  * if ndim == 1:
23442  */
23443  __Pyx_TraceLine(1414,1,__PYX_ERR(1, 1414, __pyx_L1_error))
23444  __pyx_v_extent = (__pyx_v_shape[0]);
23445 
23446  /* "View.MemoryView":1416
23447  * cdef Py_ssize_t extent = shape[0]
23448  *
23449  * if ndim == 1: # <<<<<<<<<<<<<<
23450  * for i in range(extent):
23451  * memcpy(data, item, itemsize)
23452  */
23453  __Pyx_TraceLine(1416,1,__PYX_ERR(1, 1416, __pyx_L1_error))
23454  __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
23455  if (__pyx_t_1) {
23456 
23457  /* "View.MemoryView":1417
23458  *
23459  * if ndim == 1:
23460  * for i in range(extent): # <<<<<<<<<<<<<<
23461  * memcpy(data, item, itemsize)
23462  * data += stride
23463  */
23464  __Pyx_TraceLine(1417,1,__PYX_ERR(1, 1417, __pyx_L1_error))
23465  __pyx_t_2 = __pyx_v_extent;
23466  __pyx_t_3 = __pyx_t_2;
23467  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
23468  __pyx_v_i = __pyx_t_4;
23469 
23470  /* "View.MemoryView":1418
23471  * if ndim == 1:
23472  * for i in range(extent):
23473  * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
23474  * data += stride
23475  * else:
23476  */
23477  __Pyx_TraceLine(1418,1,__PYX_ERR(1, 1418, __pyx_L1_error))
23478  (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
23479 
23480  /* "View.MemoryView":1419
23481  * for i in range(extent):
23482  * memcpy(data, item, itemsize)
23483  * data += stride # <<<<<<<<<<<<<<
23484  * else:
23485  * for i in range(extent):
23486  */
23487  __Pyx_TraceLine(1419,1,__PYX_ERR(1, 1419, __pyx_L1_error))
23488  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
23489  }
23490 
23491  /* "View.MemoryView":1416
23492  * cdef Py_ssize_t extent = shape[0]
23493  *
23494  * if ndim == 1: # <<<<<<<<<<<<<<
23495  * for i in range(extent):
23496  * memcpy(data, item, itemsize)
23497  */
23498  goto __pyx_L3;
23499  }
23500 
23501  /* "View.MemoryView":1421
23502  * data += stride
23503  * else:
23504  * for i in range(extent): # <<<<<<<<<<<<<<
23505  * _slice_assign_scalar(data, shape + 1, strides + 1,
23506  * ndim - 1, itemsize, item)
23507  */
23508  __Pyx_TraceLine(1421,1,__PYX_ERR(1, 1421, __pyx_L1_error))
23509  /*else*/ {
23510  __pyx_t_2 = __pyx_v_extent;
23511  __pyx_t_3 = __pyx_t_2;
23512  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
23513  __pyx_v_i = __pyx_t_4;
23514 
23515  /* "View.MemoryView":1422
23516  * else:
23517  * for i in range(extent):
23518  * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
23519  * ndim - 1, itemsize, item)
23520  * data += stride
23521  */
23522  __Pyx_TraceLine(1422,1,__PYX_ERR(1, 1422, __pyx_L1_error))
23523  __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
23524 
23525  /* "View.MemoryView":1424
23526  * _slice_assign_scalar(data, shape + 1, strides + 1,
23527  * ndim - 1, itemsize, item)
23528  * data += stride # <<<<<<<<<<<<<<
23529  *
23530  *
23531  */
23532  __Pyx_TraceLine(1424,1,__PYX_ERR(1, 1424, __pyx_L1_error))
23533  __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
23534  }
23535  }
23536  __pyx_L3:;
23537 
23538  /* "View.MemoryView":1409
23539  *
23540  * @cname('__pyx_memoryview__slice_assign_scalar')
23541  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
23542  * Py_ssize_t *strides, int ndim,
23543  * size_t itemsize, void *item) nogil:
23544  */
23545 
23546  /* function exit code */
23547  goto __pyx_L0;
23548  __pyx_L1_error:;
23549  __Pyx_WriteUnraisable("View.MemoryView._slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
23550  __pyx_L0:;
23551  __Pyx_TraceReturn(Py_None, 1);
23552 }
23553 
23554 /* "(tree fragment)":1
23555  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
23556  * cdef object __pyx_PickleError
23557  * cdef object __pyx_result
23558  */
23559 
23560 /* Python wrapper */
23561 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
23562 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {"__pyx_unpickle_Enum", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
23563 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
23564  PyObject *__pyx_v___pyx_type = 0;
23565  long __pyx_v___pyx_checksum;
23566  PyObject *__pyx_v___pyx_state = 0;
23567  int __pyx_lineno = 0;
23568  const char *__pyx_filename = NULL;
23569  int __pyx_clineno = 0;
23570  PyObject *__pyx_r = 0;
23571  __Pyx_RefNannyDeclarations
23572  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
23573  {
23574  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
23575  PyObject* values[3] = {0,0,0};
23576  if (unlikely(__pyx_kwds)) {
23577  Py_ssize_t kw_args;
23578  const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
23579  switch (pos_args) {
23580  case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23581  CYTHON_FALLTHROUGH;
23582  case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23583  CYTHON_FALLTHROUGH;
23584  case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23585  CYTHON_FALLTHROUGH;
23586  case 0: break;
23587  default: goto __pyx_L5_argtuple_error;
23588  }
23589  kw_args = PyDict_Size(__pyx_kwds);
23590  switch (pos_args) {
23591  case 0:
23592  if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
23593  else goto __pyx_L5_argtuple_error;
23594  CYTHON_FALLTHROUGH;
23595  case 1:
23596  if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
23597  else {
23598  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
23599  }
23600  CYTHON_FALLTHROUGH;
23601  case 2:
23602  if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
23603  else {
23604  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
23605  }
23606  }
23607  if (unlikely(kw_args > 0)) {
23608  if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
23609  }
23610  } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
23611  goto __pyx_L5_argtuple_error;
23612  } else {
23613  values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
23614  values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
23615  values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
23616  }
23617  __pyx_v___pyx_type = values[0];
23618  __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
23619  __pyx_v___pyx_state = values[2];
23620  }
23621  goto __pyx_L4_argument_unpacking_done;
23622  __pyx_L5_argtuple_error:;
23623  __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
23624  __pyx_L3_error:;
23625  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
23626  __Pyx_RefNannyFinishContext();
23627  return NULL;
23628  __pyx_L4_argument_unpacking_done:;
23629  __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
23630 
23631  /* function exit code */
23632  __Pyx_RefNannyFinishContext();
23633  return __pyx_r;
23634 }
23635 
23636 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
23637  PyObject *__pyx_v___pyx_PickleError = 0;
23638  PyObject *__pyx_v___pyx_result = 0;
23639  PyObject *__pyx_r = NULL;
23640  __Pyx_TraceDeclarations
23641  __Pyx_RefNannyDeclarations
23642  PyObject *__pyx_t_1 = NULL;
23643  int __pyx_t_2;
23644  int __pyx_t_3;
23645  PyObject *__pyx_t_4 = NULL;
23646  PyObject *__pyx_t_5 = NULL;
23647  PyObject *__pyx_t_6 = NULL;
23648  int __pyx_lineno = 0;
23649  const char *__pyx_filename = NULL;
23650  int __pyx_clineno = 0;
23651  __Pyx_TraceFrameInit(__pyx_codeobj__25)
23652  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
23653  __Pyx_TraceCall("__pyx_unpickle_Enum", __pyx_f[1], 1, 0, __PYX_ERR(1, 1, __pyx_L1_error));
23654 
23655  /* "(tree fragment)":4
23656  * cdef object __pyx_PickleError
23657  * cdef object __pyx_result
23658  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<<
23659  * from pickle import PickleError as __pyx_PickleError
23660  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23661  */
23662  __Pyx_TraceLine(4,0,__PYX_ERR(1, 4, __pyx_L1_error))
23663  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
23664  __Pyx_GOTREF(__pyx_t_1);
23665  __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__26, Py_NE)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 4, __pyx_L1_error)
23666  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23667  __pyx_t_3 = (__pyx_t_2 != 0);
23668  if (__pyx_t_3) {
23669 
23670  /* "(tree fragment)":5
23671  * cdef object __pyx_result
23672  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
23673  * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
23674  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23675  * __pyx_result = Enum.__new__(__pyx_type)
23676  */
23677  __Pyx_TraceLine(5,0,__PYX_ERR(1, 5, __pyx_L1_error))
23678  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
23679  __Pyx_GOTREF(__pyx_t_1);
23680  __Pyx_INCREF(__pyx_n_s_PickleError);
23681  __Pyx_GIVEREF(__pyx_n_s_PickleError);
23682  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
23683  __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error)
23684  __Pyx_GOTREF(__pyx_t_4);
23685  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23686  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
23687  __Pyx_GOTREF(__pyx_t_1);
23688  __Pyx_INCREF(__pyx_t_1);
23689  __pyx_v___pyx_PickleError = __pyx_t_1;
23690  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23691  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23692 
23693  /* "(tree fragment)":6
23694  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995):
23695  * from pickle import PickleError as __pyx_PickleError
23696  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
23697  * __pyx_result = Enum.__new__(__pyx_type)
23698  * if __pyx_state is not None:
23699  */
23700  __Pyx_TraceLine(6,0,__PYX_ERR(1, 6, __pyx_L1_error))
23701  __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
23702  __Pyx_GOTREF(__pyx_t_1);
23703  __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 6, __pyx_L1_error)
23704  __Pyx_GOTREF(__pyx_t_5);
23705  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23706  __Pyx_INCREF(__pyx_v___pyx_PickleError);
23707  __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
23708  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
23709  __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
23710  if (likely(__pyx_t_6)) {
23711  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
23712  __Pyx_INCREF(__pyx_t_6);
23713  __Pyx_INCREF(function);
23714  __Pyx_DECREF_SET(__pyx_t_1, function);
23715  }
23716  }
23717  __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
23718  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
23719  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
23720  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
23721  __Pyx_GOTREF(__pyx_t_4);
23722  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23723  __Pyx_Raise(__pyx_t_4, 0, 0, 0);
23724  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23725  __PYX_ERR(1, 6, __pyx_L1_error)
23726 
23727  /* "(tree fragment)":4
23728  * cdef object __pyx_PickleError
23729  * cdef object __pyx_result
23730  * if __pyx_checksum not in (0xb068931, 0x82a3537, 0x6ae9995): # <<<<<<<<<<<<<<
23731  * from pickle import PickleError as __pyx_PickleError
23732  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23733  */
23734  }
23735 
23736  /* "(tree fragment)":7
23737  * from pickle import PickleError as __pyx_PickleError
23738  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23739  * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
23740  * if __pyx_state is not None:
23741  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23742  */
23743  __Pyx_TraceLine(7,0,__PYX_ERR(1, 7, __pyx_L1_error))
23744  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 7, __pyx_L1_error)
23745  __Pyx_GOTREF(__pyx_t_1);
23746  __pyx_t_5 = NULL;
23747  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
23748  __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
23749  if (likely(__pyx_t_5)) {
23750  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
23751  __Pyx_INCREF(__pyx_t_5);
23752  __Pyx_INCREF(function);
23753  __Pyx_DECREF_SET(__pyx_t_1, function);
23754  }
23755  }
23756  __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
23757  __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
23758  if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 7, __pyx_L1_error)
23759  __Pyx_GOTREF(__pyx_t_4);
23760  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23761  __pyx_v___pyx_result = __pyx_t_4;
23762  __pyx_t_4 = 0;
23763 
23764  /* "(tree fragment)":8
23765  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23766  * __pyx_result = Enum.__new__(__pyx_type)
23767  * if __pyx_state is not None: # <<<<<<<<<<<<<<
23768  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23769  * return __pyx_result
23770  */
23771  __Pyx_TraceLine(8,0,__PYX_ERR(1, 8, __pyx_L1_error))
23772  __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
23773  __pyx_t_2 = (__pyx_t_3 != 0);
23774  if (__pyx_t_2) {
23775 
23776  /* "(tree fragment)":9
23777  * __pyx_result = Enum.__new__(__pyx_type)
23778  * if __pyx_state is not None:
23779  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
23780  * return __pyx_result
23781  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
23782  */
23783  __Pyx_TraceLine(9,0,__PYX_ERR(1, 9, __pyx_L1_error))
23784  if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((void)PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
23785  __pyx_t_4 = __pyx_unpickle_Enum__set_state(((struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 9, __pyx_L1_error)
23786  __Pyx_GOTREF(__pyx_t_4);
23787  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
23788 
23789  /* "(tree fragment)":8
23790  * raise __pyx_PickleError("Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))" % __pyx_checksum)
23791  * __pyx_result = Enum.__new__(__pyx_type)
23792  * if __pyx_state is not None: # <<<<<<<<<<<<<<
23793  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23794  * return __pyx_result
23795  */
23796  }
23797 
23798  /* "(tree fragment)":10
23799  * if __pyx_state is not None:
23800  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23801  * return __pyx_result # <<<<<<<<<<<<<<
23802  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
23803  * __pyx_result.name = __pyx_state[0]
23804  */
23805  __Pyx_TraceLine(10,0,__PYX_ERR(1, 10, __pyx_L1_error))
23806  __Pyx_XDECREF(__pyx_r);
23807  __Pyx_INCREF(__pyx_v___pyx_result);
23808  __pyx_r = __pyx_v___pyx_result;
23809  goto __pyx_L0;
23810 
23811  /* "(tree fragment)":1
23812  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
23813  * cdef object __pyx_PickleError
23814  * cdef object __pyx_result
23815  */
23816 
23817  /* function exit code */
23818  __pyx_L1_error:;
23819  __Pyx_XDECREF(__pyx_t_1);
23820  __Pyx_XDECREF(__pyx_t_4);
23821  __Pyx_XDECREF(__pyx_t_5);
23822  __Pyx_XDECREF(__pyx_t_6);
23823  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
23824  __pyx_r = NULL;
23825  __pyx_L0:;
23826  __Pyx_XDECREF(__pyx_v___pyx_PickleError);
23827  __Pyx_XDECREF(__pyx_v___pyx_result);
23828  __Pyx_XGIVEREF(__pyx_r);
23829  __Pyx_TraceReturn(__pyx_r, 0);
23830  __Pyx_RefNannyFinishContext();
23831  return __pyx_r;
23832 }
23833 
23834 /* "(tree fragment)":11
23835  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23836  * return __pyx_result
23837  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
23838  * __pyx_result.name = __pyx_state[0]
23839  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
23840  */
23841 
23842 static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
23843  PyObject *__pyx_r = NULL;
23844  __Pyx_TraceDeclarations
23845  __Pyx_RefNannyDeclarations
23846  PyObject *__pyx_t_1 = NULL;
23847  int __pyx_t_2;
23848  Py_ssize_t __pyx_t_3;
23849  int __pyx_t_4;
23850  int __pyx_t_5;
23851  PyObject *__pyx_t_6 = NULL;
23852  PyObject *__pyx_t_7 = NULL;
23853  PyObject *__pyx_t_8 = NULL;
23854  int __pyx_lineno = 0;
23855  const char *__pyx_filename = NULL;
23856  int __pyx_clineno = 0;
23857  __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
23858  __Pyx_TraceCall("__pyx_unpickle_Enum__set_state", __pyx_f[1], 11, 0, __PYX_ERR(1, 11, __pyx_L1_error));
23859 
23860  /* "(tree fragment)":12
23861  * return __pyx_result
23862  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
23863  * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
23864  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
23865  * __pyx_result.__dict__.update(__pyx_state[1])
23866  */
23867  __Pyx_TraceLine(12,0,__PYX_ERR(1, 12, __pyx_L1_error))
23868  if (unlikely(__pyx_v___pyx_state == Py_None)) {
23869  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
23870  __PYX_ERR(1, 12, __pyx_L1_error)
23871  }
23872  __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
23873  __Pyx_GOTREF(__pyx_t_1);
23874  __Pyx_GIVEREF(__pyx_t_1);
23875  __Pyx_GOTREF(__pyx_v___pyx_result->name);
23876  __Pyx_DECREF(__pyx_v___pyx_result->name);
23877  __pyx_v___pyx_result->name = __pyx_t_1;
23878  __pyx_t_1 = 0;
23879 
23880  /* "(tree fragment)":13
23881  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
23882  * __pyx_result.name = __pyx_state[0]
23883  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
23884  * __pyx_result.__dict__.update(__pyx_state[1])
23885  */
23886  __Pyx_TraceLine(13,0,__PYX_ERR(1, 13, __pyx_L1_error))
23887  if (unlikely(__pyx_v___pyx_state == Py_None)) {
23888  PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
23889  __PYX_ERR(1, 13, __pyx_L1_error)
23890  }
23891  __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
23892  __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
23893  if (__pyx_t_4) {
23894  } else {
23895  __pyx_t_2 = __pyx_t_4;
23896  goto __pyx_L4_bool_binop_done;
23897  }
23898  __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
23899  __pyx_t_5 = (__pyx_t_4 != 0);
23900  __pyx_t_2 = __pyx_t_5;
23901  __pyx_L4_bool_binop_done:;
23902  if (__pyx_t_2) {
23903 
23904  /* "(tree fragment)":14
23905  * __pyx_result.name = __pyx_state[0]
23906  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
23907  * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
23908  */
23909  __Pyx_TraceLine(14,0,__PYX_ERR(1, 14, __pyx_L1_error))
23910  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
23911  __Pyx_GOTREF(__pyx_t_6);
23912  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
23913  __Pyx_GOTREF(__pyx_t_7);
23914  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23915  if (unlikely(__pyx_v___pyx_state == Py_None)) {
23916  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
23917  __PYX_ERR(1, 14, __pyx_L1_error)
23918  }
23919  __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
23920  __Pyx_GOTREF(__pyx_t_6);
23921  __pyx_t_8 = NULL;
23922  if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
23923  __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
23924  if (likely(__pyx_t_8)) {
23925  PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
23926  __Pyx_INCREF(__pyx_t_8);
23927  __Pyx_INCREF(function);
23928  __Pyx_DECREF_SET(__pyx_t_7, function);
23929  }
23930  }
23931  __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
23932  __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
23933  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
23934  if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
23935  __Pyx_GOTREF(__pyx_t_1);
23936  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
23937  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23938 
23939  /* "(tree fragment)":13
23940  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
23941  * __pyx_result.name = __pyx_state[0]
23942  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
23943  * __pyx_result.__dict__.update(__pyx_state[1])
23944  */
23945  }
23946 
23947  /* "(tree fragment)":11
23948  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
23949  * return __pyx_result
23950  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
23951  * __pyx_result.name = __pyx_state[0]
23952  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
23953  */
23954 
23955  /* function exit code */
23956  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
23957  goto __pyx_L0;
23958  __pyx_L1_error:;
23959  __Pyx_XDECREF(__pyx_t_1);
23960  __Pyx_XDECREF(__pyx_t_6);
23961  __Pyx_XDECREF(__pyx_t_7);
23962  __Pyx_XDECREF(__pyx_t_8);
23963  __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
23964  __pyx_r = 0;
23965  __pyx_L0:;
23966  __Pyx_XGIVEREF(__pyx_r);
23967  __Pyx_TraceReturn(__pyx_r, 0);
23968  __Pyx_RefNannyFinishContext();
23969  return __pyx_r;
23970 }
23971 static struct __pyx_vtabstruct_array __pyx_vtable_array;
23972 
23973 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
23974  struct __pyx_array_obj *p;
23975  PyObject *o;
23976  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
23977  o = (*t->tp_alloc)(t, 0);
23978  } else {
23979  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
23980  }
23981  if (unlikely(!o)) return 0;
23982  p = ((struct __pyx_array_obj *)o);
23983  p->__pyx_vtab = __pyx_vtabptr_array;
23984  p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
23985  p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
23986  if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
23987  return o;
23988  bad:
23989  Py_DECREF(o); o = 0;
23990  return NULL;
23991 }
23992 
23993 static void __pyx_tp_dealloc_array(PyObject *o) {
23994  struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
23995  #if CYTHON_USE_TP_FINALIZE
23996  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
23997  if (PyObject_CallFinalizerFromDealloc(o)) return;
23998  }
23999  #endif
24000  {
24001  PyObject *etype, *eval, *etb;
24002  PyErr_Fetch(&etype, &eval, &etb);
24003  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24004  __pyx_array___dealloc__(o);
24005  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24006  PyErr_Restore(etype, eval, etb);
24007  }
24008  Py_CLEAR(p->mode);
24009  Py_CLEAR(p->_format);
24010  (*Py_TYPE(o)->tp_free)(o);
24011 }
24012 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
24013  PyObject *r;
24014  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
24015  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
24016  Py_DECREF(x);
24017  return r;
24018 }
24019 
24020 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
24021  if (v) {
24022  return __pyx_array___setitem__(o, i, v);
24023  }
24024  else {
24025  PyErr_Format(PyExc_NotImplementedError,
24026  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
24027  return -1;
24028  }
24029 }
24030 
24031 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
24032  PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
24033  if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24034  PyErr_Clear();
24035  v = __pyx_array___getattr__(o, n);
24036  }
24037  return v;
24038 }
24039 
24040 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
24041  return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
24042 }
24043 
24044 static PyMethodDef __pyx_methods_array[] = {
24045  {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
24046  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
24047  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
24048  {0, 0, 0, 0}
24049 };
24050 
24051 static struct PyGetSetDef __pyx_getsets_array[] = {
24052  {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
24053  {0, 0, 0, 0, 0}
24054 };
24055 
24056 static PySequenceMethods __pyx_tp_as_sequence_array = {
24057  __pyx_array___len__, /*sq_length*/
24058  0, /*sq_concat*/
24059  0, /*sq_repeat*/
24060  __pyx_sq_item_array, /*sq_item*/
24061  0, /*sq_slice*/
24062  0, /*sq_ass_item*/
24063  0, /*sq_ass_slice*/
24064  0, /*sq_contains*/
24065  0, /*sq_inplace_concat*/
24066  0, /*sq_inplace_repeat*/
24067 };
24068 
24069 static PyMappingMethods __pyx_tp_as_mapping_array = {
24070  __pyx_array___len__, /*mp_length*/
24071  __pyx_array___getitem__, /*mp_subscript*/
24072  __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
24073 };
24074 
24075 static PyBufferProcs __pyx_tp_as_buffer_array = {
24076  #if PY_MAJOR_VERSION < 3
24077  0, /*bf_getreadbuffer*/
24078  #endif
24079  #if PY_MAJOR_VERSION < 3
24080  0, /*bf_getwritebuffer*/
24081  #endif
24082  #if PY_MAJOR_VERSION < 3
24083  0, /*bf_getsegcount*/
24084  #endif
24085  #if PY_MAJOR_VERSION < 3
24086  0, /*bf_getcharbuffer*/
24087  #endif
24088  __pyx_array_getbuffer, /*bf_getbuffer*/
24089  0, /*bf_releasebuffer*/
24090 };
24091 
24092 static PyTypeObject __pyx_type___pyx_array = {
24093  PyVarObject_HEAD_INIT(0, 0)
24094  "imate.traceinv._hutchinson_method.array", /*tp_name*/
24095  sizeof(struct __pyx_array_obj), /*tp_basicsize*/
24096  0, /*tp_itemsize*/
24097  __pyx_tp_dealloc_array, /*tp_dealloc*/
24098  #if PY_VERSION_HEX < 0x030800b4
24099  0, /*tp_print*/
24100  #endif
24101  #if PY_VERSION_HEX >= 0x030800b4
24102  0, /*tp_vectorcall_offset*/
24103  #endif
24104  0, /*tp_getattr*/
24105  0, /*tp_setattr*/
24106  #if PY_MAJOR_VERSION < 3
24107  0, /*tp_compare*/
24108  #endif
24109  #if PY_MAJOR_VERSION >= 3
24110  0, /*tp_as_async*/
24111  #endif
24112  0, /*tp_repr*/
24113  0, /*tp_as_number*/
24114  &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
24115  &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
24116  0, /*tp_hash*/
24117  0, /*tp_call*/
24118  0, /*tp_str*/
24119  __pyx_tp_getattro_array, /*tp_getattro*/
24120  0, /*tp_setattro*/
24121  &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
24122  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
24123  0, /*tp_doc*/
24124  0, /*tp_traverse*/
24125  0, /*tp_clear*/
24126  0, /*tp_richcompare*/
24127  0, /*tp_weaklistoffset*/
24128  0, /*tp_iter*/
24129  0, /*tp_iternext*/
24130  __pyx_methods_array, /*tp_methods*/
24131  0, /*tp_members*/
24132  __pyx_getsets_array, /*tp_getset*/
24133  0, /*tp_base*/
24134  0, /*tp_dict*/
24135  0, /*tp_descr_get*/
24136  0, /*tp_descr_set*/
24137  0, /*tp_dictoffset*/
24138  0, /*tp_init*/
24139  0, /*tp_alloc*/
24140  __pyx_tp_new_array, /*tp_new*/
24141  0, /*tp_free*/
24142  0, /*tp_is_gc*/
24143  0, /*tp_bases*/
24144  0, /*tp_mro*/
24145  0, /*tp_cache*/
24146  0, /*tp_subclasses*/
24147  0, /*tp_weaklist*/
24148  0, /*tp_del*/
24149  0, /*tp_version_tag*/
24150  #if PY_VERSION_HEX >= 0x030400a1
24151  0, /*tp_finalize*/
24152  #endif
24153  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24154  0, /*tp_vectorcall*/
24155  #endif
24156  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24157  0, /*tp_print*/
24158  #endif
24159  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24160  0, /*tp_pypy_flags*/
24161  #endif
24162 };
24163 
24164 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
24165  struct __pyx_MemviewEnum_obj *p;
24166  PyObject *o;
24167  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
24168  o = (*t->tp_alloc)(t, 0);
24169  } else {
24170  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
24171  }
24172  if (unlikely(!o)) return 0;
24173  p = ((struct __pyx_MemviewEnum_obj *)o);
24174  p->name = Py_None; Py_INCREF(Py_None);
24175  return o;
24176 }
24177 
24178 static void __pyx_tp_dealloc_Enum(PyObject *o) {
24179  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
24180  #if CYTHON_USE_TP_FINALIZE
24181  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24182  if (PyObject_CallFinalizerFromDealloc(o)) return;
24183  }
24184  #endif
24185  PyObject_GC_UnTrack(o);
24186  Py_CLEAR(p->name);
24187  (*Py_TYPE(o)->tp_free)(o);
24188 }
24189 
24190 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
24191  int e;
24192  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
24193  if (p->name) {
24194  e = (*v)(p->name, a); if (e) return e;
24195  }
24196  return 0;
24197 }
24198 
24199 static int __pyx_tp_clear_Enum(PyObject *o) {
24200  PyObject* tmp;
24201  struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
24202  tmp = ((PyObject*)p->name);
24203  p->name = Py_None; Py_INCREF(Py_None);
24204  Py_XDECREF(tmp);
24205  return 0;
24206 }
24207 
24208 static PyMethodDef __pyx_methods_Enum[] = {
24209  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
24210  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
24211  {0, 0, 0, 0}
24212 };
24213 
24214 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
24215  PyVarObject_HEAD_INIT(0, 0)
24216  "imate.traceinv._hutchinson_method.Enum", /*tp_name*/
24217  sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
24218  0, /*tp_itemsize*/
24219  __pyx_tp_dealloc_Enum, /*tp_dealloc*/
24220  #if PY_VERSION_HEX < 0x030800b4
24221  0, /*tp_print*/
24222  #endif
24223  #if PY_VERSION_HEX >= 0x030800b4
24224  0, /*tp_vectorcall_offset*/
24225  #endif
24226  0, /*tp_getattr*/
24227  0, /*tp_setattr*/
24228  #if PY_MAJOR_VERSION < 3
24229  0, /*tp_compare*/
24230  #endif
24231  #if PY_MAJOR_VERSION >= 3
24232  0, /*tp_as_async*/
24233  #endif
24234  __pyx_MemviewEnum___repr__, /*tp_repr*/
24235  0, /*tp_as_number*/
24236  0, /*tp_as_sequence*/
24237  0, /*tp_as_mapping*/
24238  0, /*tp_hash*/
24239  0, /*tp_call*/
24240  0, /*tp_str*/
24241  0, /*tp_getattro*/
24242  0, /*tp_setattro*/
24243  0, /*tp_as_buffer*/
24244  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
24245  0, /*tp_doc*/
24246  __pyx_tp_traverse_Enum, /*tp_traverse*/
24247  __pyx_tp_clear_Enum, /*tp_clear*/
24248  0, /*tp_richcompare*/
24249  0, /*tp_weaklistoffset*/
24250  0, /*tp_iter*/
24251  0, /*tp_iternext*/
24252  __pyx_methods_Enum, /*tp_methods*/
24253  0, /*tp_members*/
24254  0, /*tp_getset*/
24255  0, /*tp_base*/
24256  0, /*tp_dict*/
24257  0, /*tp_descr_get*/
24258  0, /*tp_descr_set*/
24259  0, /*tp_dictoffset*/
24260  __pyx_MemviewEnum___init__, /*tp_init*/
24261  0, /*tp_alloc*/
24262  __pyx_tp_new_Enum, /*tp_new*/
24263  0, /*tp_free*/
24264  0, /*tp_is_gc*/
24265  0, /*tp_bases*/
24266  0, /*tp_mro*/
24267  0, /*tp_cache*/
24268  0, /*tp_subclasses*/
24269  0, /*tp_weaklist*/
24270  0, /*tp_del*/
24271  0, /*tp_version_tag*/
24272  #if PY_VERSION_HEX >= 0x030400a1
24273  0, /*tp_finalize*/
24274  #endif
24275  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24276  0, /*tp_vectorcall*/
24277  #endif
24278  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24279  0, /*tp_print*/
24280  #endif
24281  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24282  0, /*tp_pypy_flags*/
24283  #endif
24284 };
24285 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
24286 
24287 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
24288  struct __pyx_memoryview_obj *p;
24289  PyObject *o;
24290  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
24291  o = (*t->tp_alloc)(t, 0);
24292  } else {
24293  o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
24294  }
24295  if (unlikely(!o)) return 0;
24296  p = ((struct __pyx_memoryview_obj *)o);
24297  p->__pyx_vtab = __pyx_vtabptr_memoryview;
24298  p->obj = Py_None; Py_INCREF(Py_None);
24299  p->_size = Py_None; Py_INCREF(Py_None);
24300  p->_array_interface = Py_None; Py_INCREF(Py_None);
24301  p->view.obj = NULL;
24302  if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
24303  return o;
24304  bad:
24305  Py_DECREF(o); o = 0;
24306  return NULL;
24307 }
24308 
24309 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
24310  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
24311  #if CYTHON_USE_TP_FINALIZE
24312  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24313  if (PyObject_CallFinalizerFromDealloc(o)) return;
24314  }
24315  #endif
24316  PyObject_GC_UnTrack(o);
24317  {
24318  PyObject *etype, *eval, *etb;
24319  PyErr_Fetch(&etype, &eval, &etb);
24320  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24321  __pyx_memoryview___dealloc__(o);
24322  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24323  PyErr_Restore(etype, eval, etb);
24324  }
24325  Py_CLEAR(p->obj);
24326  Py_CLEAR(p->_size);
24327  Py_CLEAR(p->_array_interface);
24328  (*Py_TYPE(o)->tp_free)(o);
24329 }
24330 
24331 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
24332  int e;
24333  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
24334  if (p->obj) {
24335  e = (*v)(p->obj, a); if (e) return e;
24336  }
24337  if (p->_size) {
24338  e = (*v)(p->_size, a); if (e) return e;
24339  }
24340  if (p->_array_interface) {
24341  e = (*v)(p->_array_interface, a); if (e) return e;
24342  }
24343  if (p->view.obj) {
24344  e = (*v)(p->view.obj, a); if (e) return e;
24345  }
24346  return 0;
24347 }
24348 
24349 static int __pyx_tp_clear_memoryview(PyObject *o) {
24350  PyObject* tmp;
24351  struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
24352  tmp = ((PyObject*)p->obj);
24353  p->obj = Py_None; Py_INCREF(Py_None);
24354  Py_XDECREF(tmp);
24355  tmp = ((PyObject*)p->_size);
24356  p->_size = Py_None; Py_INCREF(Py_None);
24357  Py_XDECREF(tmp);
24358  tmp = ((PyObject*)p->_array_interface);
24359  p->_array_interface = Py_None; Py_INCREF(Py_None);
24360  Py_XDECREF(tmp);
24361  Py_CLEAR(p->view.obj);
24362  return 0;
24363 }
24364 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
24365  PyObject *r;
24366  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
24367  r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
24368  Py_DECREF(x);
24369  return r;
24370 }
24371 
24372 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
24373  if (v) {
24374  return __pyx_memoryview___setitem__(o, i, v);
24375  }
24376  else {
24377  PyErr_Format(PyExc_NotImplementedError,
24378  "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
24379  return -1;
24380  }
24381 }
24382 
24383 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
24384  return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
24385 }
24386 
24387 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
24388  return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
24389 }
24390 
24391 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
24392  return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
24393 }
24394 
24395 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
24396  return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
24397 }
24398 
24399 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
24400  return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
24401 }
24402 
24403 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
24404  return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
24405 }
24406 
24407 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
24408  return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
24409 }
24410 
24411 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
24412  return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
24413 }
24414 
24415 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
24416  return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
24417 }
24418 
24419 static PyMethodDef __pyx_methods_memoryview[] = {
24420  {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
24421  {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
24422  {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
24423  {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
24424  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
24425  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
24426  {0, 0, 0, 0}
24427 };
24428 
24429 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
24430  {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
24431  {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
24432  {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
24433  {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
24434  {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
24435  {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
24436  {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
24437  {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
24438  {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
24439  {0, 0, 0, 0, 0}
24440 };
24441 
24442 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
24443  __pyx_memoryview___len__, /*sq_length*/
24444  0, /*sq_concat*/
24445  0, /*sq_repeat*/
24446  __pyx_sq_item_memoryview, /*sq_item*/
24447  0, /*sq_slice*/
24448  0, /*sq_ass_item*/
24449  0, /*sq_ass_slice*/
24450  0, /*sq_contains*/
24451  0, /*sq_inplace_concat*/
24452  0, /*sq_inplace_repeat*/
24453 };
24454 
24455 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
24456  __pyx_memoryview___len__, /*mp_length*/
24457  __pyx_memoryview___getitem__, /*mp_subscript*/
24458  __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
24459 };
24460 
24461 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
24462  #if PY_MAJOR_VERSION < 3
24463  0, /*bf_getreadbuffer*/
24464  #endif
24465  #if PY_MAJOR_VERSION < 3
24466  0, /*bf_getwritebuffer*/
24467  #endif
24468  #if PY_MAJOR_VERSION < 3
24469  0, /*bf_getsegcount*/
24470  #endif
24471  #if PY_MAJOR_VERSION < 3
24472  0, /*bf_getcharbuffer*/
24473  #endif
24474  __pyx_memoryview_getbuffer, /*bf_getbuffer*/
24475  0, /*bf_releasebuffer*/
24476 };
24477 
24478 static PyTypeObject __pyx_type___pyx_memoryview = {
24479  PyVarObject_HEAD_INIT(0, 0)
24480  "imate.traceinv._hutchinson_method.memoryview", /*tp_name*/
24481  sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
24482  0, /*tp_itemsize*/
24483  __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
24484  #if PY_VERSION_HEX < 0x030800b4
24485  0, /*tp_print*/
24486  #endif
24487  #if PY_VERSION_HEX >= 0x030800b4
24488  0, /*tp_vectorcall_offset*/
24489  #endif
24490  0, /*tp_getattr*/
24491  0, /*tp_setattr*/
24492  #if PY_MAJOR_VERSION < 3
24493  0, /*tp_compare*/
24494  #endif
24495  #if PY_MAJOR_VERSION >= 3
24496  0, /*tp_as_async*/
24497  #endif
24498  __pyx_memoryview___repr__, /*tp_repr*/
24499  0, /*tp_as_number*/
24500  &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
24501  &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
24502  0, /*tp_hash*/
24503  0, /*tp_call*/
24504  __pyx_memoryview___str__, /*tp_str*/
24505  0, /*tp_getattro*/
24506  0, /*tp_setattro*/
24507  &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
24508  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
24509  0, /*tp_doc*/
24510  __pyx_tp_traverse_memoryview, /*tp_traverse*/
24511  __pyx_tp_clear_memoryview, /*tp_clear*/
24512  0, /*tp_richcompare*/
24513  0, /*tp_weaklistoffset*/
24514  0, /*tp_iter*/
24515  0, /*tp_iternext*/
24516  __pyx_methods_memoryview, /*tp_methods*/
24517  0, /*tp_members*/
24518  __pyx_getsets_memoryview, /*tp_getset*/
24519  0, /*tp_base*/
24520  0, /*tp_dict*/
24521  0, /*tp_descr_get*/
24522  0, /*tp_descr_set*/
24523  0, /*tp_dictoffset*/
24524  0, /*tp_init*/
24525  0, /*tp_alloc*/
24526  __pyx_tp_new_memoryview, /*tp_new*/
24527  0, /*tp_free*/
24528  0, /*tp_is_gc*/
24529  0, /*tp_bases*/
24530  0, /*tp_mro*/
24531  0, /*tp_cache*/
24532  0, /*tp_subclasses*/
24533  0, /*tp_weaklist*/
24534  0, /*tp_del*/
24535  0, /*tp_version_tag*/
24536  #if PY_VERSION_HEX >= 0x030400a1
24537  0, /*tp_finalize*/
24538  #endif
24539  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24540  0, /*tp_vectorcall*/
24541  #endif
24542  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24543  0, /*tp_print*/
24544  #endif
24545  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24546  0, /*tp_pypy_flags*/
24547  #endif
24548 };
24549 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
24550 
24551 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
24552  struct __pyx_memoryviewslice_obj *p;
24553  PyObject *o = __pyx_tp_new_memoryview(t, a, k);
24554  if (unlikely(!o)) return 0;
24555  p = ((struct __pyx_memoryviewslice_obj *)o);
24556  p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
24557  p->from_object = Py_None; Py_INCREF(Py_None);
24558  p->from_slice.memview = NULL;
24559  return o;
24560 }
24561 
24562 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
24563  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
24564  #if CYTHON_USE_TP_FINALIZE
24565  if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
24566  if (PyObject_CallFinalizerFromDealloc(o)) return;
24567  }
24568  #endif
24569  PyObject_GC_UnTrack(o);
24570  {
24571  PyObject *etype, *eval, *etb;
24572  PyErr_Fetch(&etype, &eval, &etb);
24573  __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
24574  __pyx_memoryviewslice___dealloc__(o);
24575  __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
24576  PyErr_Restore(etype, eval, etb);
24577  }
24578  Py_CLEAR(p->from_object);
24579  PyObject_GC_Track(o);
24580  __pyx_tp_dealloc_memoryview(o);
24581 }
24582 
24583 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
24584  int e;
24585  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
24586  e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
24587  if (p->from_object) {
24588  e = (*v)(p->from_object, a); if (e) return e;
24589  }
24590  return 0;
24591 }
24592 
24593 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
24594  PyObject* tmp;
24595  struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
24596  __pyx_tp_clear_memoryview(o);
24597  tmp = ((PyObject*)p->from_object);
24598  p->from_object = Py_None; Py_INCREF(Py_None);
24599  Py_XDECREF(tmp);
24600  __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
24601  return 0;
24602 }
24603 
24604 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
24605  return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
24606 }
24607 
24608 static PyMethodDef __pyx_methods__memoryviewslice[] = {
24609  {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
24610  {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
24611  {0, 0, 0, 0}
24612 };
24613 
24614 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
24615  {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
24616  {0, 0, 0, 0, 0}
24617 };
24618 
24619 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
24620  PyVarObject_HEAD_INIT(0, 0)
24621  "imate.traceinv._hutchinson_method._memoryviewslice", /*tp_name*/
24622  sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
24623  0, /*tp_itemsize*/
24624  __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
24625  #if PY_VERSION_HEX < 0x030800b4
24626  0, /*tp_print*/
24627  #endif
24628  #if PY_VERSION_HEX >= 0x030800b4
24629  0, /*tp_vectorcall_offset*/
24630  #endif
24631  0, /*tp_getattr*/
24632  0, /*tp_setattr*/
24633  #if PY_MAJOR_VERSION < 3
24634  0, /*tp_compare*/
24635  #endif
24636  #if PY_MAJOR_VERSION >= 3
24637  0, /*tp_as_async*/
24638  #endif
24639  #if CYTHON_COMPILING_IN_PYPY
24640  __pyx_memoryview___repr__, /*tp_repr*/
24641  #else
24642  0, /*tp_repr*/
24643  #endif
24644  0, /*tp_as_number*/
24645  0, /*tp_as_sequence*/
24646  0, /*tp_as_mapping*/
24647  0, /*tp_hash*/
24648  0, /*tp_call*/
24649  #if CYTHON_COMPILING_IN_PYPY
24650  __pyx_memoryview___str__, /*tp_str*/
24651  #else
24652  0, /*tp_str*/
24653  #endif
24654  0, /*tp_getattro*/
24655  0, /*tp_setattro*/
24656  0, /*tp_as_buffer*/
24657  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
24658  "Internal class for passing memoryview slices to Python", /*tp_doc*/
24659  __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
24660  __pyx_tp_clear__memoryviewslice, /*tp_clear*/
24661  0, /*tp_richcompare*/
24662  0, /*tp_weaklistoffset*/
24663  0, /*tp_iter*/
24664  0, /*tp_iternext*/
24665  __pyx_methods__memoryviewslice, /*tp_methods*/
24666  0, /*tp_members*/
24667  __pyx_getsets__memoryviewslice, /*tp_getset*/
24668  0, /*tp_base*/
24669  0, /*tp_dict*/
24670  0, /*tp_descr_get*/
24671  0, /*tp_descr_set*/
24672  0, /*tp_dictoffset*/
24673  0, /*tp_init*/
24674  0, /*tp_alloc*/
24675  __pyx_tp_new__memoryviewslice, /*tp_new*/
24676  0, /*tp_free*/
24677  0, /*tp_is_gc*/
24678  0, /*tp_bases*/
24679  0, /*tp_mro*/
24680  0, /*tp_cache*/
24681  0, /*tp_subclasses*/
24682  0, /*tp_weaklist*/
24683  0, /*tp_del*/
24684  0, /*tp_version_tag*/
24685  #if PY_VERSION_HEX >= 0x030400a1
24686  0, /*tp_finalize*/
24687  #endif
24688  #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
24689  0, /*tp_vectorcall*/
24690  #endif
24691  #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
24692  0, /*tp_print*/
24693  #endif
24694  #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
24695  0, /*tp_pypy_flags*/
24696  #endif
24697 };
24698 
24699 static PyMethodDef __pyx_methods[] = {
24700  {0, 0, 0, 0}
24701 };
24702 
24703 #if PY_MAJOR_VERSION >= 3
24704 #if CYTHON_PEP489_MULTI_PHASE_INIT
24705 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
24706 static int __pyx_pymod_exec__hutchinson_method(PyObject* module); /*proto*/
24707 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
24708  {Py_mod_create, (void*)__pyx_pymod_create},
24709  {Py_mod_exec, (void*)__pyx_pymod_exec__hutchinson_method},
24710  {0, NULL}
24711 };
24712 #endif
24713 
24714 static struct PyModuleDef __pyx_moduledef = {
24715  PyModuleDef_HEAD_INIT,
24716  "_hutchinson_method",
24717  0, /* m_doc */
24718  #if CYTHON_PEP489_MULTI_PHASE_INIT
24719  0, /* m_size */
24720  #else
24721  -1, /* m_size */
24722  #endif
24723  __pyx_methods /* m_methods */,
24724  #if CYTHON_PEP489_MULTI_PHASE_INIT
24725  __pyx_moduledef_slots, /* m_slots */
24726  #else
24727  NULL, /* m_reload */
24728  #endif
24729  NULL, /* m_traverse */
24730  NULL, /* m_clear */
24731  NULL /* m_free */
24732 };
24733 #endif
24734 #ifndef CYTHON_SMALL_CODE
24735 #if defined(__clang__)
24736  #define CYTHON_SMALL_CODE
24737 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
24738  #define CYTHON_SMALL_CODE __attribute__((cold))
24739 #else
24740  #define CYTHON_SMALL_CODE
24741 #endif
24742 #endif
24743 
24744 static __Pyx_StringTabEntry __pyx_string_tab[] = {
24745  {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1},
24746  {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
24747  {&__pyx_n_s_AinvpE, __pyx_k_AinvpE, sizeof(__pyx_k_AinvpE), 0, 0, 1, 1},
24748  {&__pyx_n_s_AtA, __pyx_k_AtA, sizeof(__pyx_k_AtA), 0, 0, 1, 1},
24749  {&__pyx_kp_u_AtA_cannot_be_None, __pyx_k_AtA_cannot_be_None, sizeof(__pyx_k_AtA_cannot_be_None), 0, 1, 0, 0},
24750  {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1},
24751  {&__pyx_n_s_BE, __pyx_k_BE, sizeof(__pyx_k_BE), 0, 0, 1, 1},
24752  {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri, sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
24753  {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1},
24754  {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is, sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
24755  {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor, sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
24756  {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi, sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
24757  {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s, sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
24758  {&__pyx_kp_u_Data_type_should_be_either_float, __pyx_k_Data_type_should_be_either_float, sizeof(__pyx_k_Data_type_should_be_either_float), 0, 1, 0, 0},
24759  {&__pyx_n_s_E, __pyx_k_E, sizeof(__pyx_k_E), 0, 0, 1, 1},
24760  {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
24761  {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
24762  {&__pyx_n_u_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 1, 0, 1},
24763  {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0, sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
24764  {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
24765  {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
24766  {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
24767  {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d, sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
24768  {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
24769  {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x, sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
24770  {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
24771  {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
24772  {&__pyx_n_s_OpE, __pyx_k_OpE, sizeof(__pyx_k_OpE), 0, 0, 1, 1},
24773  {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a, sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
24774  {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
24775  {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
24776  {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1},
24777  {&__pyx_kp_u_Trace_of_matrix_or_linear_opera, __pyx_k_Trace_of_matrix_or_linear_opera, sizeof(__pyx_k_Trace_of_matrix_or_linear_opera), 0, 1, 0, 0},
24778  {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
24779  {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object, sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
24780  {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
24781  {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
24782  {&__pyx_n_s_abs, __pyx_k_abs, sizeof(__pyx_k_abs), 0, 0, 1, 1},
24783  {&__pyx_n_u_absolute_error, __pyx_k_absolute_error, sizeof(__pyx_k_absolute_error), 0, 1, 0, 1},
24784  {&__pyx_n_s_alg_wall_time, __pyx_k_alg_wall_time, sizeof(__pyx_k_alg_wall_time), 0, 0, 1, 1},
24785  {&__pyx_n_u_alg_wall_time, __pyx_k_alg_wall_time, sizeof(__pyx_k_alg_wall_time), 0, 1, 0, 1},
24786  {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
24787  {&__pyx_n_s_assume_matrix, __pyx_k_assume_matrix, sizeof(__pyx_k_assume_matrix), 0, 0, 1, 1},
24788  {&__pyx_n_u_assume_matrix, __pyx_k_assume_matrix, sizeof(__pyx_k_assume_matrix), 0, 1, 0, 1},
24789  {&__pyx_n_s_average_estimates, __pyx_k_average_estimates, sizeof(__pyx_k_average_estimates), 0, 0, 1, 1},
24790  {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
24791  {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
24792  {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
24793  {&__pyx_n_s_cE, __pyx_k_cE, sizeof(__pyx_k_cE), 0, 0, 1, 1},
24794  {&__pyx_n_s_check_arguments, __pyx_k_check_arguments, sizeof(__pyx_k_check_arguments), 0, 0, 1, 1},
24795  {&__pyx_n_s_check_convergence, __pyx_k_check_convergence, sizeof(__pyx_k_check_convergence), 0, 0, 1, 1},
24796  {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
24797  {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
24798  {&__pyx_n_s_confidence_level, __pyx_k_confidence_level, sizeof(__pyx_k_confidence_level), 0, 0, 1, 1},
24799  {&__pyx_n_u_confidence_level, __pyx_k_confidence_level, sizeof(__pyx_k_confidence_level), 0, 1, 0, 1},
24800  {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
24801  {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
24802  {&__pyx_n_s_converged, __pyx_k_converged, sizeof(__pyx_k_converged), 0, 0, 1, 1},
24803  {&__pyx_n_u_converged, __pyx_k_converged, sizeof(__pyx_k_converged), 0, 1, 0, 1},
24804  {&__pyx_n_u_convergence, __pyx_k_convergence, sizeof(__pyx_k_convergence), 0, 1, 0, 1},
24805  {&__pyx_n_s_convergence_tools, __pyx_k_convergence_tools, sizeof(__pyx_k_convergence_tools), 0, 0, 1, 1},
24806  {&__pyx_n_s_cpu_count, __pyx_k_cpu_count, sizeof(__pyx_k_cpu_count), 0, 0, 1, 1},
24807  {&__pyx_n_s_cpu_proc_time, __pyx_k_cpu_proc_time, sizeof(__pyx_k_cpu_proc_time), 0, 0, 1, 1},
24808  {&__pyx_n_u_cpu_proc_time, __pyx_k_cpu_proc_time, sizeof(__pyx_k_cpu_proc_time), 0, 1, 0, 1},
24809  {&__pyx_n_u_data_type, __pyx_k_data_type, sizeof(__pyx_k_data_type), 0, 1, 0, 1},
24810  {&__pyx_n_s_data_type_name, __pyx_k_data_type_name, sizeof(__pyx_k_data_type_name), 0, 0, 1, 1},
24811  {&__pyx_n_u_density, __pyx_k_density, sizeof(__pyx_k_density), 0, 1, 0, 1},
24812  {&__pyx_n_u_device, __pyx_k_device, sizeof(__pyx_k_device), 0, 1, 0, 1},
24813  {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
24814  {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
24815  {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
24816  {&__pyx_n_s_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 0, 0, 1, 1},
24817  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
24818  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
24819  {&__pyx_n_s_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 0, 0, 1, 1},
24820  {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
24821  {&__pyx_n_u_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 1, 0, 1},
24822  {&__pyx_n_s_error_atol, __pyx_k_error_atol, sizeof(__pyx_k_error_atol), 0, 0, 1, 1},
24823  {&__pyx_n_u_error_atol, __pyx_k_error_atol, sizeof(__pyx_k_error_atol), 0, 1, 0, 1},
24824  {&__pyx_n_s_error_rtol, __pyx_k_error_rtol, sizeof(__pyx_k_error_rtol), 0, 0, 1, 1},
24825  {&__pyx_n_u_error_rtol, __pyx_k_error_rtol, sizeof(__pyx_k_error_rtol), 0, 1, 0, 1},
24826  {&__pyx_n_u_exponent, __pyx_k_exponent, sizeof(__pyx_k_exponent), 0, 1, 0, 1},
24827  {&__pyx_n_s_finfo, __pyx_k_finfo, sizeof(__pyx_k_finfo), 0, 0, 1, 1},
24828  {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
24829  {&__pyx_n_b_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 0, 1},
24830  {&__pyx_n_s_float32, __pyx_k_float32, sizeof(__pyx_k_float32), 0, 0, 1, 1},
24831  {&__pyx_n_b_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 0, 1},
24832  {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1},
24833  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
24834  {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
24835  {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
24836  {&__pyx_n_u_gen, __pyx_k_gen, sizeof(__pyx_k_gen), 0, 1, 0, 1},
24837  {&__pyx_n_s_get_data_type_name, __pyx_k_get_data_type_name, sizeof(__pyx_k_get_data_type_name), 0, 0, 1, 1},
24838  {&__pyx_n_s_get_density, __pyx_k_get_density, sizeof(__pyx_k_get_density), 0, 0, 1, 1},
24839  {&__pyx_n_s_get_nnz, __pyx_k_get_nnz, sizeof(__pyx_k_get_nnz), 0, 0, 1, 1},
24840  {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
24841  {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi, sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
24842  {&__pyx_n_s_gram, __pyx_k_gram, sizeof(__pyx_k_gram), 0, 0, 1, 1},
24843  {&__pyx_n_u_gram, __pyx_k_gram, sizeof(__pyx_k_gram), 0, 1, 0, 1},
24844  {&__pyx_n_u_hutchinson, __pyx_k_hutchinson, sizeof(__pyx_k_hutchinson), 0, 1, 0, 1},
24845  {&__pyx_n_s_hutchinson_method, __pyx_k_hutchinson_method, sizeof(__pyx_k_hutchinson_method), 0, 0, 1, 1},
24846  {&__pyx_n_s_hutchinson_method_double, __pyx_k_hutchinson_method_double, sizeof(__pyx_k_hutchinson_method_double), 0, 0, 1, 1},
24847  {&__pyx_n_s_hutchinson_method_float, __pyx_k_hutchinson_method_float, sizeof(__pyx_k_hutchinson_method_float), 0, 0, 1, 1},
24848  {&__pyx_kp_u_hutchinson_method_line_37, __pyx_k_hutchinson_method_line_37, sizeof(__pyx_k_hutchinson_method_line_37), 0, 1, 0, 0},
24849  {&__pyx_n_s_hutchinson_method_utilities, __pyx_k_hutchinson_method_utilities, sizeof(__pyx_k_hutchinson_method_utilities), 0, 0, 1, 1},
24850  {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
24851  {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
24852  {&__pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_k_imate_traceinv__hutchinson_metho, sizeof(__pyx_k_imate_traceinv__hutchinson_metho), 0, 0, 1, 0},
24853  {&__pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_k_imate_traceinv__hutchinson_metho_2, sizeof(__pyx_k_imate_traceinv__hutchinson_metho_2), 0, 0, 1, 1},
24854  {&__pyx_n_s_imatmul, __pyx_k_imatmul, sizeof(__pyx_k_imatmul), 0, 0, 1, 1},
24855  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
24856  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
24857  {&__pyx_n_s_init_alg_wall_time, __pyx_k_init_alg_wall_time, sizeof(__pyx_k_init_alg_wall_time), 0, 0, 1, 1},
24858  {&__pyx_n_s_init_cpu_proc_time, __pyx_k_init_cpu_proc_time, sizeof(__pyx_k_init_cpu_proc_time), 0, 0, 1, 1},
24859  {&__pyx_n_s_init_tot_wall_time, __pyx_k_init_tot_wall_time, sizeof(__pyx_k_init_tot_wall_time), 0, 0, 1, 1},
24860  {&__pyx_n_s_isspmatrix, __pyx_k_isspmatrix, sizeof(__pyx_k_isspmatrix), 0, 0, 1, 1},
24861  {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
24862  {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array, sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
24863  {&__pyx_n_s_linear_algebra, __pyx_k_linear_algebra, sizeof(__pyx_k_linear_algebra), 0, 0, 1, 1},
24864  {&__pyx_n_s_linear_algebra_matrix_utilities, __pyx_k_linear_algebra_matrix_utilities, sizeof(__pyx_k_linear_algebra_matrix_utilities), 0, 0, 1, 1},
24865  {&__pyx_n_s_linear_solver, __pyx_k_linear_solver, sizeof(__pyx_k_linear_solver), 0, 0, 1, 1},
24866  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
24867  {&__pyx_n_s_matmul, __pyx_k_matmul, sizeof(__pyx_k_matmul), 0, 0, 1, 1},
24868  {&__pyx_n_u_matrix, __pyx_k_matrix, sizeof(__pyx_k_matrix), 0, 1, 0, 1},
24869  {&__pyx_n_s_max_num_samples, __pyx_k_max_num_samples, sizeof(__pyx_k_max_num_samples), 0, 0, 1, 1},
24870  {&__pyx_n_u_max_num_samples, __pyx_k_max_num_samples, sizeof(__pyx_k_max_num_samples), 0, 1, 0, 1},
24871  {&__pyx_n_s_memoryview_E, __pyx_k_memoryview_E, sizeof(__pyx_k_memoryview_E), 0, 0, 1, 1},
24872  {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
24873  {&__pyx_n_u_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 1, 0, 1},
24874  {&__pyx_n_s_min_num_samples, __pyx_k_min_num_samples, sizeof(__pyx_k_min_num_samples), 0, 0, 1, 1},
24875  {&__pyx_n_u_min_num_samples, __pyx_k_min_num_samples, sizeof(__pyx_k_min_num_samples), 0, 1, 0, 1},
24876  {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
24877  {&__pyx_n_s_multiprocessing, __pyx_k_multiprocessing, sizeof(__pyx_k_multiprocessing), 0, 0, 1, 1},
24878  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
24879  {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
24880  {&__pyx_n_s_nan, __pyx_k_nan, sizeof(__pyx_k_nan), 0, 0, 1, 1},
24881  {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
24882  {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
24883  {&__pyx_n_u_nnz, __pyx_k_nnz, sizeof(__pyx_k_nnz), 0, 1, 0, 1},
24884  {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
24885  {&__pyx_n_u_num_cpu_threads, __pyx_k_num_cpu_threads, sizeof(__pyx_k_num_cpu_threads), 0, 1, 0, 1},
24886  {&__pyx_n_u_num_gpu_devices, __pyx_k_num_gpu_devices, sizeof(__pyx_k_num_gpu_devices), 0, 1, 0, 1},
24887  {&__pyx_n_u_num_gpu_multiprocessors, __pyx_k_num_gpu_multiprocessors, sizeof(__pyx_k_num_gpu_multiprocessors), 0, 1, 0, 1},
24888  {&__pyx_n_u_num_gpu_threads_per_multiprocess, __pyx_k_num_gpu_threads_per_multiprocess, sizeof(__pyx_k_num_gpu_threads_per_multiprocess), 0, 1, 0, 1},
24889  {&__pyx_n_u_num_inquiries, __pyx_k_num_inquiries, sizeof(__pyx_k_num_inquiries), 0, 1, 0, 1},
24890  {&__pyx_n_s_num_outliers, __pyx_k_num_outliers, sizeof(__pyx_k_num_outliers), 0, 0, 1, 1},
24891  {&__pyx_n_u_num_outliers, __pyx_k_num_outliers, sizeof(__pyx_k_num_outliers), 0, 1, 0, 1},
24892  {&__pyx_n_s_num_processed_samples, __pyx_k_num_processed_samples, sizeof(__pyx_k_num_processed_samples), 0, 0, 1, 1},
24893  {&__pyx_n_s_num_samples_used, __pyx_k_num_samples_used, sizeof(__pyx_k_num_samples_used), 0, 0, 1, 1},
24894  {&__pyx_n_u_num_samples_used, __pyx_k_num_samples_used, sizeof(__pyx_k_num_samples_used), 0, 1, 0, 1},
24895  {&__pyx_n_s_num_threads, __pyx_k_num_threads, sizeof(__pyx_k_num_threads), 0, 0, 1, 1},
24896  {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
24897  {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
24898  {&__pyx_n_s_operator_dot, __pyx_k_operator_dot, sizeof(__pyx_k_operator_dot), 0, 0, 1, 1},
24899  {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
24900  {&__pyx_n_s_orthogonalize, __pyx_k_orthogonalize, sizeof(__pyx_k_orthogonalize), 0, 0, 1, 1},
24901  {&__pyx_n_u_orthogonalize, __pyx_k_orthogonalize, sizeof(__pyx_k_orthogonalize), 0, 1, 0, 1},
24902  {&__pyx_n_s_outlier_significance_level, __pyx_k_outlier_significance_level, sizeof(__pyx_k_outlier_significance_level), 0, 0, 1, 1},
24903  {&__pyx_n_u_outlier_significance_level, __pyx_k_outlier_significance_level, sizeof(__pyx_k_outlier_significance_level), 0, 1, 0, 1},
24904  {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
24905  {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
24906  {&__pyx_n_s_perf_counter, __pyx_k_perf_counter, sizeof(__pyx_k_perf_counter), 0, 0, 1, 1},
24907  {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
24908  {&__pyx_n_s_plot, __pyx_k_plot, sizeof(__pyx_k_plot), 0, 0, 1, 1},
24909  {&__pyx_n_s_plot_convergence, __pyx_k_plot_convergence, sizeof(__pyx_k_plot_convergence), 0, 0, 1, 1},
24910  {&__pyx_n_s_print_summary, __pyx_k_print_summary, sizeof(__pyx_k_print_summary), 0, 0, 1, 1},
24911  {&__pyx_n_s_process_time, __pyx_k_process_time, sizeof(__pyx_k_process_time), 0, 0, 1, 1},
24912  {&__pyx_n_s_processed_samples_indices, __pyx_k_processed_samples_indices, sizeof(__pyx_k_processed_samples_indices), 0, 0, 1, 1},
24913  {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
24914  {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
24915  {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
24916  {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
24917  {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
24918  {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
24919  {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
24920  {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
24921  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
24922  {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
24923  {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
24924  {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
24925  {&__pyx_n_u_relative_error, __pyx_k_relative_error, sizeof(__pyx_k_relative_error), 0, 1, 0, 1},
24926  {&__pyx_n_s_return_info, __pyx_k_return_info, sizeof(__pyx_k_return_info), 0, 0, 1, 1},
24927  {&__pyx_n_s_rmatmul, __pyx_k_rmatmul, sizeof(__pyx_k_rmatmul), 0, 0, 1, 1},
24928  {&__pyx_n_s_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 0, 1, 1},
24929  {&__pyx_n_u_samples, __pyx_k_samples, sizeof(__pyx_k_samples), 0, 1, 0, 1},
24930  {&__pyx_n_u_samples_mean, __pyx_k_samples_mean, sizeof(__pyx_k_samples_mean), 0, 1, 0, 1},
24931  {&__pyx_n_u_samples_processed_order, __pyx_k_samples_processed_order, sizeof(__pyx_k_samples_processed_order), 0, 1, 0, 1},
24932  {&__pyx_n_s_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 0, 1, 1},
24933  {&__pyx_n_s_scipy_sparse, __pyx_k_scipy_sparse, sizeof(__pyx_k_scipy_sparse), 0, 0, 1, 1},
24934  {&__pyx_n_s_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 0, 1, 1},
24935  {&__pyx_n_u_seed, __pyx_k_seed, sizeof(__pyx_k_seed), 0, 1, 0, 1},
24936  {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
24937  {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
24938  {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
24939  {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
24940  {&__pyx_n_u_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 1, 0, 1},
24941  {&__pyx_n_u_solver, __pyx_k_solver, sizeof(__pyx_k_solver), 0, 1, 0, 1},
24942  {&__pyx_n_s_solver_tol, __pyx_k_solver_tol, sizeof(__pyx_k_solver_tol), 0, 0, 1, 1},
24943  {&__pyx_n_u_solver_tol, __pyx_k_solver_tol, sizeof(__pyx_k_solver_tol), 0, 1, 0, 1},
24944  {&__pyx_n_u_sparse, __pyx_k_sparse, sizeof(__pyx_k_sparse), 0, 1, 0, 1},
24945  {&__pyx_n_s_square, __pyx_k_square, sizeof(__pyx_k_square), 0, 0, 1, 1},
24946  {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
24947  {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
24948  {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
24949  {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
24950  {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect, sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
24951  {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
24952  {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
24953  {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
24954  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
24955  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
24956  {&__pyx_n_u_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 1, 0, 1},
24957  {&__pyx_n_s_tot_wall_time, __pyx_k_tot_wall_time, sizeof(__pyx_k_tot_wall_time), 0, 0, 1, 1},
24958  {&__pyx_n_u_tot_wall_time, __pyx_k_tot_wall_time, sizeof(__pyx_k_tot_wall_time), 0, 1, 0, 1},
24959  {&__pyx_n_s_trace, __pyx_k_trace, sizeof(__pyx_k_trace), 0, 0, 1, 1},
24960  {&__pyx_n_s_trace_estimator_trace_estimator, __pyx_k_trace_estimator_trace_estimator, sizeof(__pyx_k_trace_estimator_trace_estimator), 0, 0, 1, 1},
24961  {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data, sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
24962  {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str, sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
24963  {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
24964  {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
24965  {&__pyx_n_s_vector_size, __pyx_k_vector_size, sizeof(__pyx_k_vector_size), 0, 0, 1, 1},
24966  {&__pyx_n_s_verbose, __pyx_k_verbose, sizeof(__pyx_k_verbose), 0, 0, 1, 1},
24967  {&__pyx_n_u_version, __pyx_k_version, sizeof(__pyx_k_version), 0, 1, 0, 1},
24968  {&__pyx_n_s_version_2, __pyx_k_version_2, sizeof(__pyx_k_version_2), 0, 0, 1, 1},
24969  {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
24970  {0, 0, 0, 0, 0, 0, 0}
24971 };
24972 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
24973  __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 663, __pyx_L1_error)
24974  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 801, __pyx_L1_error)
24975  __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 978, __pyx_L1_error)
24976  __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 134, __pyx_L1_error)
24977  __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 149, __pyx_L1_error)
24978  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 152, __pyx_L1_error)
24979  __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 406, __pyx_L1_error)
24980  __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(1, 615, __pyx_L1_error)
24981  __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(1, 834, __pyx_L1_error)
24982  return 0;
24983  __pyx_L1_error:;
24984  return -1;
24985 }
24986 
24987 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
24988  __Pyx_RefNannyDeclarations
24989  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
24990 
24991  /* "imate/traceinv/_hutchinson_method.pyx":663
24992  * num_threads)
24993  * else:
24994  * raise TypeError('Data type should be either "float32" or "float64"') # <<<<<<<<<<<<<<
24995  *
24996  * # Dictionary of output info
24997  */
24998  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Data_type_should_be_either_float); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 663, __pyx_L1_error)
24999  __Pyx_GOTREF(__pyx_tuple__2);
25000  __Pyx_GIVEREF(__pyx_tuple__2);
25001 
25002  /* "imate/traceinv/_hutchinson_method.pyx":783
25003  * samples = numpy.zeros((max_num_samples, ), dtype=numpy.float32)
25004  * processed_samples_indices = numpy.zeros((max_num_samples, ), dtype=int)
25005  * samples[:] = numpy.nan # <<<<<<<<<<<<<<
25006  * cdef int num_processed_samples = 0
25007  * cdef int num_samples_used = 0
25008  */
25009  __pyx_slice__4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 783, __pyx_L1_error)
25010  __Pyx_GOTREF(__pyx_slice__4);
25011  __Pyx_GIVEREF(__pyx_slice__4);
25012 
25013  /* "imate/traceinv/_hutchinson_method.pyx":978
25014  * if gram and (AtA is None):
25015  * if not ((p == 1) and (B is None) and (C is None)):
25016  * raise RuntimeError('"AtA" cannot be None.') # <<<<<<<<<<<<<<
25017  *
25018  * # Multiply operator * B * E
25019  */
25020  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_AtA_cannot_be_None); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 978, __pyx_L1_error)
25021  __Pyx_GOTREF(__pyx_tuple__6);
25022  __Pyx_GIVEREF(__pyx_tuple__6);
25023 
25024  /* "View.MemoryView":134
25025  *
25026  * if not self.ndim:
25027  * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
25028  *
25029  * if itemsize <= 0:
25030  */
25031  __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 134, __pyx_L1_error)
25032  __Pyx_GOTREF(__pyx_tuple__8);
25033  __Pyx_GIVEREF(__pyx_tuple__8);
25034 
25035  /* "View.MemoryView":137
25036  *
25037  * if itemsize <= 0:
25038  * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
25039  *
25040  * if not isinstance(format, bytes):
25041  */
25042  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 137, __pyx_L1_error)
25043  __Pyx_GOTREF(__pyx_tuple__9);
25044  __Pyx_GIVEREF(__pyx_tuple__9);
25045 
25046  /* "View.MemoryView":149
25047  *
25048  * if not self._shape:
25049  * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
25050  *
25051  *
25052  */
25053  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 149, __pyx_L1_error)
25054  __Pyx_GOTREF(__pyx_tuple__10);
25055  __Pyx_GIVEREF(__pyx_tuple__10);
25056 
25057  /* "View.MemoryView":177
25058  * self.data = <char *>malloc(self.len)
25059  * if not self.data:
25060  * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
25061  *
25062  * if self.dtype_is_object:
25063  */
25064  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 177, __pyx_L1_error)
25065  __Pyx_GOTREF(__pyx_tuple__11);
25066  __Pyx_GIVEREF(__pyx_tuple__11);
25067 
25068  /* "View.MemoryView":193
25069  * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
25070  * if not (flags & bufmode):
25071  * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
25072  * info.buf = self.data
25073  * info.len = self.len
25074  */
25075  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 193, __pyx_L1_error)
25076  __Pyx_GOTREF(__pyx_tuple__12);
25077  __Pyx_GIVEREF(__pyx_tuple__12);
25078 
25079  /* "(tree fragment)":2
25080  * def __reduce_cython__(self):
25081  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25082  * def __setstate_cython__(self, __pyx_state):
25083  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25084  */
25085  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 2, __pyx_L1_error)
25086  __Pyx_GOTREF(__pyx_tuple__13);
25087  __Pyx_GIVEREF(__pyx_tuple__13);
25088 
25089  /* "(tree fragment)":4
25090  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25091  * def __setstate_cython__(self, __pyx_state):
25092  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25093  */
25094  __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 4, __pyx_L1_error)
25095  __Pyx_GOTREF(__pyx_tuple__14);
25096  __Pyx_GIVEREF(__pyx_tuple__14);
25097 
25098  /* "View.MemoryView":420
25099  * def __setitem__(memoryview self, object index, object value):
25100  * if self.view.readonly:
25101  * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
25102  *
25103  * have_slices, index = _unellipsify(index, self.view.ndim)
25104  */
25105  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 420, __pyx_L1_error)
25106  __Pyx_GOTREF(__pyx_tuple__15);
25107  __Pyx_GIVEREF(__pyx_tuple__15);
25108 
25109  /* "View.MemoryView":497
25110  * result = struct.unpack(self.view.format, bytesitem)
25111  * except struct.error:
25112  * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
25113  * else:
25114  * if len(self.view.format) == 1:
25115  */
25116  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 497, __pyx_L1_error)
25117  __Pyx_GOTREF(__pyx_tuple__16);
25118  __Pyx_GIVEREF(__pyx_tuple__16);
25119 
25120  /* "View.MemoryView":522
25121  * def __getbuffer__(self, Py_buffer *info, int flags):
25122  * if flags & PyBUF_WRITABLE and self.view.readonly:
25123  * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
25124  *
25125  * if flags & PyBUF_ND:
25126  */
25127  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 522, __pyx_L1_error)
25128  __Pyx_GOTREF(__pyx_tuple__17);
25129  __Pyx_GIVEREF(__pyx_tuple__17);
25130 
25131  /* "View.MemoryView":572
25132  * if self.view.strides == NULL:
25133  *
25134  * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
25135  *
25136  * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
25137  */
25138  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 572, __pyx_L1_error)
25139  __Pyx_GOTREF(__pyx_tuple__18);
25140  __Pyx_GIVEREF(__pyx_tuple__18);
25141 
25142  /* "View.MemoryView":579
25143  * def suboffsets(self):
25144  * if self.view.suboffsets == NULL:
25145  * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
25146  *
25147  * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
25148  */
25149  __pyx_tuple__19 = PyTuple_New(1); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 579, __pyx_L1_error)
25150  __Pyx_GOTREF(__pyx_tuple__19);
25151  __Pyx_INCREF(__pyx_int_neg_1);
25152  __Pyx_GIVEREF(__pyx_int_neg_1);
25153  PyTuple_SET_ITEM(__pyx_tuple__19, 0, __pyx_int_neg_1);
25154  __Pyx_GIVEREF(__pyx_tuple__19);
25155 
25156  /* "(tree fragment)":2
25157  * def __reduce_cython__(self):
25158  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25159  * def __setstate_cython__(self, __pyx_state):
25160  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25161  */
25162  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 2, __pyx_L1_error)
25163  __Pyx_GOTREF(__pyx_tuple__20);
25164  __Pyx_GIVEREF(__pyx_tuple__20);
25165 
25166  /* "(tree fragment)":4
25167  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25168  * def __setstate_cython__(self, __pyx_state):
25169  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25170  */
25171  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 4, __pyx_L1_error)
25172  __Pyx_GOTREF(__pyx_tuple__21);
25173  __Pyx_GIVEREF(__pyx_tuple__21);
25174 
25175  /* "View.MemoryView":705
25176  * for suboffset in suboffsets[:ndim]:
25177  * if suboffset >= 0:
25178  * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
25179  *
25180  *
25181  */
25182  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 705, __pyx_L1_error)
25183  __Pyx_GOTREF(__pyx_tuple__22);
25184  __Pyx_GIVEREF(__pyx_tuple__22);
25185 
25186  /* "(tree fragment)":2
25187  * def __reduce_cython__(self):
25188  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25189  * def __setstate_cython__(self, __pyx_state):
25190  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25191  */
25192  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
25193  __Pyx_GOTREF(__pyx_tuple__23);
25194  __Pyx_GIVEREF(__pyx_tuple__23);
25195 
25196  /* "(tree fragment)":4
25197  * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
25198  * def __setstate_cython__(self, __pyx_state):
25199  * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
25200  */
25201  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
25202  __Pyx_GOTREF(__pyx_tuple__24);
25203  __Pyx_GIVEREF(__pyx_tuple__24);
25204  __pyx_tuple__26 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 4, __pyx_L1_error)
25205  __Pyx_GOTREF(__pyx_tuple__26);
25206  __Pyx_GIVEREF(__pyx_tuple__26);
25207 
25208  /* "imate/traceinv/_hutchinson_method.pyx":37
25209  * # =================
25210  *
25211  * def hutchinson_method( # <<<<<<<<<<<<<<
25212  * A,
25213  * gram=False,
25214  */
25215  __pyx_tuple__27 = PyTuple_Pack(33, __pyx_n_s_A, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_return_info, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_verbose, __pyx_n_s_plot, __pyx_n_s_square, __pyx_n_s_data_type_name, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_tot_wall_time, __pyx_n_s_alg_wall_time, __pyx_n_s_cpu_proc_time, __pyx_n_s_info); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 37, __pyx_L1_error)
25216  __Pyx_GOTREF(__pyx_tuple__27);
25217  __Pyx_GIVEREF(__pyx_tuple__27);
25218  __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(19, 0, 33, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method, 37, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 37, __pyx_L1_error)
25219  __pyx_tuple__28 = PyTuple_Pack(18, ((PyObject *)Py_False), ((PyObject *)__pyx_int_1), ((PyObject *)Py_False), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject*)__pyx_n_u_gen), ((PyObject *)__pyx_int_10), ((PyObject *)__pyx_int_50), ((PyObject *)Py_None), ((PyObject*)__pyx_float_1eneg_2), ((PyObject*)__pyx_float_0_95), ((PyObject*)__pyx_float_0_001), ((PyObject*)__pyx_float_1eneg_6), ((PyObject *)Py_True), ((PyObject *)Py_None), ((PyObject *)__pyx_int_0), ((PyObject *)Py_False), ((PyObject *)Py_False)); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 37, __pyx_L1_error)
25220  __Pyx_GOTREF(__pyx_tuple__28);
25221  __Pyx_GIVEREF(__pyx_tuple__28);
25222 
25223  /* "imate/traceinv/_hutchinson_method.pyx":741
25224  * # =======================
25225  *
25226  * def _hutchinson_method_float( # <<<<<<<<<<<<<<
25227  * A,
25228  * B,
25229  */
25230  __pyx_tuple__29 = PyTuple_Pack(36, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_vector_size, __pyx_n_s_E, __pyx_n_s_memoryview_E, __pyx_n_s_cE, __pyx_n_s_init_tot_wall_time, __pyx_n_s_init_cpu_proc_time, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_init_alg_wall_time, __pyx_n_s_AtA, __pyx_n_s_i, __pyx_n_s_alg_wall_time, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_tot_wall_time, __pyx_n_s_cpu_proc_time); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 741, __pyx_L1_error)
25231  __Pyx_GOTREF(__pyx_tuple__29);
25232  __Pyx_GIVEREF(__pyx_tuple__29);
25233  __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(16, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method_float, 741, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 741, __pyx_L1_error)
25234 
25235  /* "imate/traceinv/_hutchinson_method.pyx":839
25236  * # ========================
25237  *
25238  * def _hutchinson_method_double( # <<<<<<<<<<<<<<
25239  * A,
25240  * B,
25241  */
25242  __pyx_tuple__30 = PyTuple_Pack(36, __pyx_n_s_A, __pyx_n_s_B, __pyx_n_s_C, __pyx_n_s_gram, __pyx_n_s_p, __pyx_n_s_assume_matrix, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_solver_tol, __pyx_n_s_orthogonalize, __pyx_n_s_seed, __pyx_n_s_num_threads, __pyx_n_s_vector_size, __pyx_n_s_E, __pyx_n_s_memoryview_E, __pyx_n_s_cE, __pyx_n_s_init_tot_wall_time, __pyx_n_s_init_cpu_proc_time, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_processed_samples, __pyx_n_s_num_samples_used, __pyx_n_s_converged, __pyx_n_s_init_alg_wall_time, __pyx_n_s_AtA, __pyx_n_s_i, __pyx_n_s_alg_wall_time, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_num_outliers, __pyx_n_s_tot_wall_time, __pyx_n_s_cpu_proc_time); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 839, __pyx_L1_error)
25243  __Pyx_GOTREF(__pyx_tuple__30);
25244  __Pyx_GIVEREF(__pyx_tuple__30);
25245  __pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(16, 0, 36, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_hutchinson_method_double, 839, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) __PYX_ERR(0, 839, __pyx_L1_error)
25246 
25247  /* "imate/traceinv/_hutchinson_method.pyx":1095
25248  * # ============
25249  *
25250  * def _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E): # <<<<<<<<<<<<<<
25251  * """
25252  * Computes either of the followings:
25253  */
25254  __pyx_tuple__31 = PyTuple_Pack(12, __pyx_n_s_A, __pyx_n_s_AtA, __pyx_n_s_p, __pyx_n_s_gram, __pyx_n_s_assume_matrix, __pyx_n_s_solver_tol, __pyx_n_s_B, __pyx_n_s_E, __pyx_n_s_BE, __pyx_n_s_OpE, __pyx_n_s_i, __pyx_n_s_AinvpE); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1095, __pyx_L1_error)
25255  __Pyx_GOTREF(__pyx_tuple__31);
25256  __Pyx_GIVEREF(__pyx_tuple__31);
25257  __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate_traceinv__hutchinson_metho, __pyx_n_s_operator_dot, 1095, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 1095, __pyx_L1_error)
25258 
25259  /* "View.MemoryView":287
25260  * return self.name
25261  *
25262  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
25263  * cdef strided = Enum("<strided and direct>") # default
25264  * cdef indirect = Enum("<strided and indirect>")
25265  */
25266  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(1, 287, __pyx_L1_error)
25267  __Pyx_GOTREF(__pyx_tuple__32);
25268  __Pyx_GIVEREF(__pyx_tuple__32);
25269 
25270  /* "View.MemoryView":288
25271  *
25272  * cdef generic = Enum("<strided and direct or indirect>")
25273  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
25274  * cdef indirect = Enum("<strided and indirect>")
25275  *
25276  */
25277  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(1, 288, __pyx_L1_error)
25278  __Pyx_GOTREF(__pyx_tuple__33);
25279  __Pyx_GIVEREF(__pyx_tuple__33);
25280 
25281  /* "View.MemoryView":289
25282  * cdef generic = Enum("<strided and direct or indirect>")
25283  * cdef strided = Enum("<strided and direct>") # default
25284  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
25285  *
25286  *
25287  */
25288  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(1, 289, __pyx_L1_error)
25289  __Pyx_GOTREF(__pyx_tuple__34);
25290  __Pyx_GIVEREF(__pyx_tuple__34);
25291 
25292  /* "View.MemoryView":292
25293  *
25294  *
25295  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
25296  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
25297  *
25298  */
25299  __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(1, 292, __pyx_L1_error)
25300  __Pyx_GOTREF(__pyx_tuple__35);
25301  __Pyx_GIVEREF(__pyx_tuple__35);
25302 
25303  /* "View.MemoryView":293
25304  *
25305  * cdef contiguous = Enum("<contiguous and direct>")
25306  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
25307  *
25308  *
25309  */
25310  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(1, 293, __pyx_L1_error)
25311  __Pyx_GOTREF(__pyx_tuple__36);
25312  __Pyx_GIVEREF(__pyx_tuple__36);
25313 
25314  /* "(tree fragment)":1
25315  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
25316  * cdef object __pyx_PickleError
25317  * cdef object __pyx_result
25318  */
25319  __pyx_tuple__37 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(1, 1, __pyx_L1_error)
25320  __Pyx_GOTREF(__pyx_tuple__37);
25321  __Pyx_GIVEREF(__pyx_tuple__37);
25322  __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(1, 1, __pyx_L1_error)
25323  __Pyx_RefNannyFinishContext();
25324  return 0;
25325  __pyx_L1_error:;
25326  __Pyx_RefNannyFinishContext();
25327  return -1;
25328 }
25329 
25330 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
25331  /* AssertionsEnabled.init */
25332  __Pyx_init_assertions_enabled();
25333 
25334 if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
25335 
25336  if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25337  __pyx_float_0_95 = PyFloat_FromDouble(0.95); if (unlikely(!__pyx_float_0_95)) __PYX_ERR(0, 1, __pyx_L1_error)
25338  __pyx_float_1eneg_2 = PyFloat_FromDouble(1e-2); if (unlikely(!__pyx_float_1eneg_2)) __PYX_ERR(0, 1, __pyx_L1_error)
25339  __pyx_float_1eneg_6 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_float_1eneg_6)) __PYX_ERR(0, 1, __pyx_L1_error)
25340  __pyx_float_0_001 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_float_0_001)) __PYX_ERR(0, 1, __pyx_L1_error)
25341  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
25342  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25343  __pyx_int_10 = PyInt_FromLong(10); if (unlikely(!__pyx_int_10)) __PYX_ERR(0, 1, __pyx_L1_error)
25344  __pyx_int_50 = PyInt_FromLong(50); if (unlikely(!__pyx_int_50)) __PYX_ERR(0, 1, __pyx_L1_error)
25345  __pyx_int_112105877 = PyInt_FromLong(112105877L); if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
25346  __pyx_int_136983863 = PyInt_FromLong(136983863L); if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
25347  __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
25348  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
25349  return 0;
25350  __pyx_L1_error:;
25351  return -1;
25352 }
25353 
25354 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
25355 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
25356 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
25357 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
25358 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
25359 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
25360 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
25361 
25362 static int __Pyx_modinit_global_init_code(void) {
25363  __Pyx_RefNannyDeclarations
25364  __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
25365  /*--- Global init code ---*/
25366  generic = Py_None; Py_INCREF(Py_None);
25367  strided = Py_None; Py_INCREF(Py_None);
25368  indirect = Py_None; Py_INCREF(Py_None);
25369  contiguous = Py_None; Py_INCREF(Py_None);
25370  indirect_contiguous = Py_None; Py_INCREF(Py_None);
25371  __Pyx_RefNannyFinishContext();
25372  return 0;
25373 }
25374 
25375 static int __Pyx_modinit_variable_export_code(void) {
25376  __Pyx_RefNannyDeclarations
25377  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
25378  /*--- Variable export code ---*/
25379  __Pyx_RefNannyFinishContext();
25380  return 0;
25381 }
25382 
25383 static int __Pyx_modinit_function_export_code(void) {
25384  __Pyx_RefNannyDeclarations
25385  __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
25386  /*--- Function export code ---*/
25387  __Pyx_RefNannyFinishContext();
25388  return 0;
25389 }
25390 
25391 static int __Pyx_modinit_type_init_code(void) {
25392  __Pyx_RefNannyDeclarations
25393  int __pyx_lineno = 0;
25394  const char *__pyx_filename = NULL;
25395  int __pyx_clineno = 0;
25396  __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
25397  /*--- Type init code ---*/
25398  __pyx_vtabptr_array = &__pyx_vtable_array;
25399  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
25400  if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25401  #if PY_VERSION_HEX < 0x030800B1
25402  __pyx_type___pyx_array.tp_print = 0;
25403  #endif
25404  if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25405  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 106, __pyx_L1_error)
25406  __pyx_array_type = &__pyx_type___pyx_array;
25407  if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 280, __pyx_L1_error)
25408  #if PY_VERSION_HEX < 0x030800B1
25409  __pyx_type___pyx_MemviewEnum.tp_print = 0;
25410  #endif
25411  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
25412  __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25413  }
25414  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 280, __pyx_L1_error)
25415  __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
25416  __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
25417  __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
25418  __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
25419  __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
25420  __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
25421  __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
25422  __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
25423  __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
25424  if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25425  #if PY_VERSION_HEX < 0x030800B1
25426  __pyx_type___pyx_memoryview.tp_print = 0;
25427  #endif
25428  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
25429  __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25430  }
25431  if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25432  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 331, __pyx_L1_error)
25433  __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
25434  __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
25435  __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
25436  __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
25437  __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
25438  __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
25439  if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25440  #if PY_VERSION_HEX < 0x030800B1
25441  __pyx_type___pyx_memoryviewslice.tp_print = 0;
25442  #endif
25443  if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
25444  __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
25445  }
25446  if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25447  if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 967, __pyx_L1_error)
25448  __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
25449  __Pyx_RefNannyFinishContext();
25450  return 0;
25451  __pyx_L1_error:;
25452  __Pyx_RefNannyFinishContext();
25453  return -1;
25454 }
25455 
25456 static int __Pyx_modinit_type_import_code(void) {
25457  __Pyx_RefNannyDeclarations
25458  __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
25459  /*--- Type import code ---*/
25460  __Pyx_RefNannyFinishContext();
25461  return 0;
25462 }
25463 
25464 static int __Pyx_modinit_variable_import_code(void) {
25465  __Pyx_RefNannyDeclarations
25466  __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
25467  /*--- Variable import code ---*/
25468  __Pyx_RefNannyFinishContext();
25469  return 0;
25470 }
25471 
25472 static int __Pyx_modinit_function_import_code(void) {
25473  __Pyx_RefNannyDeclarations
25474  PyObject *__pyx_t_1 = NULL;
25475  int __pyx_lineno = 0;
25476  const char *__pyx_filename = NULL;
25477  int __pyx_clineno = 0;
25478  __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
25479  /*--- Function import code ---*/
25480  __pyx_t_1 = PyImport_ImportModule("imate._linear_algebra.orthogonalization"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
25481  __Pyx_GOTREF(__pyx_t_1);
25482  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_0orthogonalize_vectors", (void (**)(void))&__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors, "void (float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25483  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_1orthogonalize_vectors", (void (**)(void))&__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors, "void (double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25484  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_2orthogonalize_vectors", (void (**)(void))&__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_17orthogonalization_orthogonalize_vectors, "void (long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25485  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25486  __pyx_t_1 = PyImport_ImportModule("imate._linear_algebra.random_vectors"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
25487  __Pyx_GOTREF(__pyx_t_1);
25488  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_0generate_random_column_vectors", (void (**)(void))&__pyx_fuse_0__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors, "void (float *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25489  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_1generate_random_column_vectors", (void (**)(void))&__pyx_fuse_1__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors, "void (double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25490  if (__Pyx_ImportFunction_0_29_36(__pyx_t_1, "__pyx_fuse_2generate_random_column_vectors", (void (**)(void))&__pyx_fuse_2__pyx_f_5imate_15_linear_algebra_14random_vectors_generate_random_column_vectors, "void (long double *, LongIndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const , __pyx_t_5imate_12_definitions_5types_IndexType const )") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25491  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25492  __Pyx_RefNannyFinishContext();
25493  return 0;
25494  __pyx_L1_error:;
25495  __Pyx_XDECREF(__pyx_t_1);
25496  __Pyx_RefNannyFinishContext();
25497  return -1;
25498 }
25499 
25500 
25501 #ifndef CYTHON_NO_PYINIT_EXPORT
25502 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
25503 #elif PY_MAJOR_VERSION < 3
25504 #ifdef __cplusplus
25505 #define __Pyx_PyMODINIT_FUNC extern "C" void
25506 #else
25507 #define __Pyx_PyMODINIT_FUNC void
25508 #endif
25509 #else
25510 #ifdef __cplusplus
25511 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
25512 #else
25513 #define __Pyx_PyMODINIT_FUNC PyObject *
25514 #endif
25515 #endif
25516 
25517 
25518 #if PY_MAJOR_VERSION < 3
25519 __Pyx_PyMODINIT_FUNC init_hutchinson_method(void) CYTHON_SMALL_CODE; /*proto*/
25520 __Pyx_PyMODINIT_FUNC init_hutchinson_method(void)
25521 #else
25522 __Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void) CYTHON_SMALL_CODE; /*proto*/
25523 __Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void)
25524 #if CYTHON_PEP489_MULTI_PHASE_INIT
25525 {
25526  return PyModuleDef_Init(&__pyx_moduledef);
25527 }
25528 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
25529  #if PY_VERSION_HEX >= 0x030700A1
25530  static PY_INT64_T main_interpreter_id = -1;
25531  PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
25532  if (main_interpreter_id == -1) {
25533  main_interpreter_id = current_id;
25534  return (unlikely(current_id == -1)) ? -1 : 0;
25535  } else if (unlikely(main_interpreter_id != current_id))
25536  #else
25537  static PyInterpreterState *main_interpreter = NULL;
25538  PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
25539  if (!main_interpreter) {
25540  main_interpreter = current_interpreter;
25541  } else if (unlikely(main_interpreter != current_interpreter))
25542  #endif
25543  {
25544  PyErr_SetString(
25545  PyExc_ImportError,
25546  "Interpreter change detected - this module can only be loaded into one interpreter per process.");
25547  return -1;
25548  }
25549  return 0;
25550 }
25551 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
25552  PyObject *value = PyObject_GetAttrString(spec, from_name);
25553  int result = 0;
25554  if (likely(value)) {
25555  if (allow_none || value != Py_None) {
25556  result = PyDict_SetItemString(moddict, to_name, value);
25557  }
25558  Py_DECREF(value);
25559  } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
25560  PyErr_Clear();
25561  } else {
25562  result = -1;
25563  }
25564  return result;
25565 }
25566 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
25567  PyObject *module = NULL, *moddict, *modname;
25568  if (__Pyx_check_single_interpreter())
25569  return NULL;
25570  if (__pyx_m)
25571  return __Pyx_NewRef(__pyx_m);
25572  modname = PyObject_GetAttrString(spec, "name");
25573  if (unlikely(!modname)) goto bad;
25574  module = PyModule_NewObject(modname);
25575  Py_DECREF(modname);
25576  if (unlikely(!module)) goto bad;
25577  moddict = PyModule_GetDict(module);
25578  if (unlikely(!moddict)) goto bad;
25579  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
25580  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
25581  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
25582  if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
25583  return module;
25584 bad:
25585  Py_XDECREF(module);
25586  return NULL;
25587 }
25588 
25589 
25590 static CYTHON_SMALL_CODE int __pyx_pymod_exec__hutchinson_method(PyObject *__pyx_pyinit_module)
25591 #endif
25592 #endif
25593 {
25594  __Pyx_TraceDeclarations
25595  PyObject *__pyx_t_1 = NULL;
25596  PyObject *__pyx_t_2 = NULL;
25597  static PyThread_type_lock __pyx_t_3[8];
25598  int __pyx_lineno = 0;
25599  const char *__pyx_filename = NULL;
25600  int __pyx_clineno = 0;
25601  __Pyx_RefNannyDeclarations
25602  #if CYTHON_PEP489_MULTI_PHASE_INIT
25603  if (__pyx_m) {
25604  if (__pyx_m == __pyx_pyinit_module) return 0;
25605  PyErr_SetString(PyExc_RuntimeError, "Module '_hutchinson_method' has already been imported. Re-initialisation is not supported.");
25606  return -1;
25607  }
25608  #elif PY_MAJOR_VERSION >= 3
25609  if (__pyx_m) return __Pyx_NewRef(__pyx_m);
25610  #endif
25611  #if CYTHON_REFNANNY
25612 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
25613 if (!__Pyx_RefNanny) {
25614  PyErr_Clear();
25615  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
25616  if (!__Pyx_RefNanny)
25617  Py_FatalError("failed to import 'refnanny' module");
25618 }
25619 #endif
25620  __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void)", 0);
25621  if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25622  #ifdef __Pxy_PyFrame_Initialize_Offsets
25623  __Pxy_PyFrame_Initialize_Offsets();
25624  #endif
25625  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
25626  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
25627  __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
25628  #ifdef __Pyx_CyFunction_USED
25629  if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25630  #endif
25631  #ifdef __Pyx_FusedFunction_USED
25632  if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25633  #endif
25634  #ifdef __Pyx_Coroutine_USED
25635  if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25636  #endif
25637  #ifdef __Pyx_Generator_USED
25638  if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25639  #endif
25640  #ifdef __Pyx_AsyncGen_USED
25641  if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25642  #endif
25643  #ifdef __Pyx_StopAsyncIteration_USED
25644  if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25645  #endif
25646  /*--- Library function declarations ---*/
25647  /*--- Threads initialization code ---*/
25648  #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
25649  PyEval_InitThreads();
25650  #endif
25651  /*--- Module creation code ---*/
25652  #if CYTHON_PEP489_MULTI_PHASE_INIT
25653  __pyx_m = __pyx_pyinit_module;
25654  Py_INCREF(__pyx_m);
25655  #else
25656  #if PY_MAJOR_VERSION < 3
25657  __pyx_m = Py_InitModule4("_hutchinson_method", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
25658  #else
25659  __pyx_m = PyModule_Create(&__pyx_moduledef);
25660  #endif
25661  if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
25662  #endif
25663  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
25664  Py_INCREF(__pyx_d);
25665  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
25666  Py_INCREF(__pyx_b);
25667  __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
25668  Py_INCREF(__pyx_cython_runtime);
25669  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25670  /*--- Initialize various global constants etc. ---*/
25671  if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25672  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
25673  if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25674  #endif
25675  if (__pyx_module_is_main_imate__traceinv___hutchinson_method) {
25676  if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25677  }
25678  #if PY_MAJOR_VERSION >= 3
25679  {
25680  PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
25681  if (!PyDict_GetItemString(modules, "imate.traceinv._hutchinson_method")) {
25682  if (unlikely(PyDict_SetItemString(modules, "imate.traceinv._hutchinson_method", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25683  }
25684  }
25685  #endif
25686  /*--- Builtin init code ---*/
25687  if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25688  /*--- Constants init code ---*/
25689  if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25690  /*--- Global type/function init code ---*/
25691  (void)__Pyx_modinit_global_init_code();
25692  (void)__Pyx_modinit_variable_export_code();
25693  (void)__Pyx_modinit_function_export_code();
25694  if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25695  (void)__Pyx_modinit_type_import_code();
25696  (void)__Pyx_modinit_variable_import_code();
25697  if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
25698  /*--- Execution code ---*/
25699  #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
25700  if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
25701  #endif
25702  __Pyx_TraceCall("__Pyx_PyMODINIT_FUNC PyInit__hutchinson_method(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
25703 
25704  /* "imate/traceinv/_hutchinson_method.pyx":15
25705  *
25706  * # Python
25707  * import time # <<<<<<<<<<<<<<
25708  * import numpy
25709  * import scipy.sparse
25710  */
25711  __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
25712  __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
25713  __Pyx_GOTREF(__pyx_t_1);
25714  if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
25715  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25716 
25717  /* "imate/traceinv/_hutchinson_method.pyx":16
25718  * # Python
25719  * import time
25720  * import numpy # <<<<<<<<<<<<<<
25721  * import scipy.sparse
25722  * from scipy.sparse import isspmatrix
25723  */
25724  __Pyx_TraceLine(16,0,__PYX_ERR(0, 16, __pyx_L1_error))
25725  __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
25726  __Pyx_GOTREF(__pyx_t_1);
25727  if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
25728  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25729 
25730  /* "imate/traceinv/_hutchinson_method.pyx":17
25731  * import time
25732  * import numpy
25733  * import scipy.sparse # <<<<<<<<<<<<<<
25734  * from scipy.sparse import isspmatrix
25735  * import multiprocessing
25736  */
25737  __Pyx_TraceLine(17,0,__PYX_ERR(0, 17, __pyx_L1_error))
25738  __pyx_t_1 = __Pyx_Import(__pyx_n_s_scipy_sparse, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error)
25739  __Pyx_GOTREF(__pyx_t_1);
25740  if (PyDict_SetItem(__pyx_d, __pyx_n_s_scipy, __pyx_t_1) < 0) __PYX_ERR(0, 17, __pyx_L1_error)
25741  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25742 
25743  /* "imate/traceinv/_hutchinson_method.pyx":18
25744  * import numpy
25745  * import scipy.sparse
25746  * from scipy.sparse import isspmatrix # <<<<<<<<<<<<<<
25747  * import multiprocessing
25748  * from ..__version__ import __version__
25749  */
25750  __Pyx_TraceLine(18,0,__PYX_ERR(0, 18, __pyx_L1_error))
25751  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
25752  __Pyx_GOTREF(__pyx_t_1);
25753  __Pyx_INCREF(__pyx_n_s_isspmatrix);
25754  __Pyx_GIVEREF(__pyx_n_s_isspmatrix);
25755  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_isspmatrix);
25756  __pyx_t_2 = __Pyx_Import(__pyx_n_s_scipy_sparse, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error)
25757  __Pyx_GOTREF(__pyx_t_2);
25758  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25759  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_isspmatrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
25760  __Pyx_GOTREF(__pyx_t_1);
25761  if (PyDict_SetItem(__pyx_d, __pyx_n_s_isspmatrix, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
25762  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25763  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25764 
25765  /* "imate/traceinv/_hutchinson_method.pyx":19
25766  * import scipy.sparse
25767  * from scipy.sparse import isspmatrix
25768  * import multiprocessing # <<<<<<<<<<<<<<
25769  * from ..__version__ import __version__
25770  * from .._linear_algebra import linear_solver
25771  */
25772  __Pyx_TraceLine(19,0,__PYX_ERR(0, 19, __pyx_L1_error))
25773  __pyx_t_2 = __Pyx_Import(__pyx_n_s_multiprocessing, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
25774  __Pyx_GOTREF(__pyx_t_2);
25775  if (PyDict_SetItem(__pyx_d, __pyx_n_s_multiprocessing, __pyx_t_2) < 0) __PYX_ERR(0, 19, __pyx_L1_error)
25776  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25777 
25778  /* "imate/traceinv/_hutchinson_method.pyx":20
25779  * from scipy.sparse import isspmatrix
25780  * import multiprocessing
25781  * from ..__version__ import __version__ # <<<<<<<<<<<<<<
25782  * from .._linear_algebra import linear_solver
25783  * from ._convergence_tools import check_convergence, average_estimates
25784  */
25785  __Pyx_TraceLine(20,0,__PYX_ERR(0, 20, __pyx_L1_error))
25786  __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
25787  __Pyx_GOTREF(__pyx_t_2);
25788  __Pyx_INCREF(__pyx_n_s_version_2);
25789  __Pyx_GIVEREF(__pyx_n_s_version_2);
25790  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_version_2);
25791  __pyx_t_1 = __Pyx_Import(__pyx_n_s_version_2, __pyx_t_2, 2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
25792  __Pyx_GOTREF(__pyx_t_1);
25793  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25794  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_version_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error)
25795  __Pyx_GOTREF(__pyx_t_2);
25796  if (PyDict_SetItem(__pyx_d, __pyx_n_s_version_2, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error)
25797  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25798  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25799 
25800  /* "imate/traceinv/_hutchinson_method.pyx":21
25801  * import multiprocessing
25802  * from ..__version__ import __version__
25803  * from .._linear_algebra import linear_solver # <<<<<<<<<<<<<<
25804  * from ._convergence_tools import check_convergence, average_estimates
25805  * from .._trace_estimator.trace_estimator_plot_utilities import plot_convergence
25806  */
25807  __Pyx_TraceLine(21,0,__PYX_ERR(0, 21, __pyx_L1_error))
25808  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
25809  __Pyx_GOTREF(__pyx_t_1);
25810  __Pyx_INCREF(__pyx_n_s_linear_solver);
25811  __Pyx_GIVEREF(__pyx_n_s_linear_solver);
25812  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_linear_solver);
25813  __pyx_t_2 = __Pyx_Import(__pyx_n_s_linear_algebra, __pyx_t_1, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error)
25814  __Pyx_GOTREF(__pyx_t_2);
25815  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25816  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_linear_solver); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
25817  __Pyx_GOTREF(__pyx_t_1);
25818  if (PyDict_SetItem(__pyx_d, __pyx_n_s_linear_solver, __pyx_t_1) < 0) __PYX_ERR(0, 21, __pyx_L1_error)
25819  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25820  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25821 
25822  /* "imate/traceinv/_hutchinson_method.pyx":22
25823  * from ..__version__ import __version__
25824  * from .._linear_algebra import linear_solver
25825  * from ._convergence_tools import check_convergence, average_estimates # <<<<<<<<<<<<<<
25826  * from .._trace_estimator.trace_estimator_plot_utilities import plot_convergence
25827  * from ._hutchinson_method_utilities import check_arguments, print_summary
25828  */
25829  __Pyx_TraceLine(22,0,__PYX_ERR(0, 22, __pyx_L1_error))
25830  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25831  __Pyx_GOTREF(__pyx_t_2);
25832  __Pyx_INCREF(__pyx_n_s_check_convergence);
25833  __Pyx_GIVEREF(__pyx_n_s_check_convergence);
25834  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_check_convergence);
25835  __Pyx_INCREF(__pyx_n_s_average_estimates);
25836  __Pyx_GIVEREF(__pyx_n_s_average_estimates);
25837  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_average_estimates);
25838  __pyx_t_1 = __Pyx_Import(__pyx_n_s_convergence_tools, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error)
25839  __Pyx_GOTREF(__pyx_t_1);
25840  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25841  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_convergence); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25842  __Pyx_GOTREF(__pyx_t_2);
25843  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_convergence, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
25844  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25845  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_average_estimates); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error)
25846  __Pyx_GOTREF(__pyx_t_2);
25847  if (PyDict_SetItem(__pyx_d, __pyx_n_s_average_estimates, __pyx_t_2) < 0) __PYX_ERR(0, 22, __pyx_L1_error)
25848  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25849  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25850 
25851  /* "imate/traceinv/_hutchinson_method.pyx":23
25852  * from .._linear_algebra import linear_solver
25853  * from ._convergence_tools import check_convergence, average_estimates
25854  * from .._trace_estimator.trace_estimator_plot_utilities import plot_convergence # <<<<<<<<<<<<<<
25855  * from ._hutchinson_method_utilities import check_arguments, print_summary
25856  * from .._linear_algebra.matrix_utilities import get_data_type_name, get_nnz, \
25857  */
25858  __Pyx_TraceLine(23,0,__PYX_ERR(0, 23, __pyx_L1_error))
25859  __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
25860  __Pyx_GOTREF(__pyx_t_1);
25861  __Pyx_INCREF(__pyx_n_s_plot_convergence);
25862  __Pyx_GIVEREF(__pyx_n_s_plot_convergence);
25863  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_plot_convergence);
25864  __pyx_t_2 = __Pyx_Import(__pyx_n_s_trace_estimator_trace_estimator, __pyx_t_1, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error)
25865  __Pyx_GOTREF(__pyx_t_2);
25866  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25867  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_plot_convergence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error)
25868  __Pyx_GOTREF(__pyx_t_1);
25869  if (PyDict_SetItem(__pyx_d, __pyx_n_s_plot_convergence, __pyx_t_1) < 0) __PYX_ERR(0, 23, __pyx_L1_error)
25870  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25871  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25872 
25873  /* "imate/traceinv/_hutchinson_method.pyx":24
25874  * from ._convergence_tools import check_convergence, average_estimates
25875  * from .._trace_estimator.trace_estimator_plot_utilities import plot_convergence
25876  * from ._hutchinson_method_utilities import check_arguments, print_summary # <<<<<<<<<<<<<<
25877  * from .._linear_algebra.matrix_utilities import get_data_type_name, get_nnz, \
25878  * get_density
25879  */
25880  __Pyx_TraceLine(24,0,__PYX_ERR(0, 24, __pyx_L1_error))
25881  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25882  __Pyx_GOTREF(__pyx_t_2);
25883  __Pyx_INCREF(__pyx_n_s_check_arguments);
25884  __Pyx_GIVEREF(__pyx_n_s_check_arguments);
25885  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_check_arguments);
25886  __Pyx_INCREF(__pyx_n_s_print_summary);
25887  __Pyx_GIVEREF(__pyx_n_s_print_summary);
25888  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_print_summary);
25889  __pyx_t_1 = __Pyx_Import(__pyx_n_s_hutchinson_method_utilities, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error)
25890  __Pyx_GOTREF(__pyx_t_1);
25891  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25892  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_check_arguments); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25893  __Pyx_GOTREF(__pyx_t_2);
25894  if (PyDict_SetItem(__pyx_d, __pyx_n_s_check_arguments, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
25895  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25896  __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_print_summary); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error)
25897  __Pyx_GOTREF(__pyx_t_2);
25898  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_summary, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error)
25899  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25900  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25901 
25902  /* "imate/traceinv/_hutchinson_method.pyx":25
25903  * from .._trace_estimator.trace_estimator_plot_utilities import plot_convergence
25904  * from ._hutchinson_method_utilities import check_arguments, print_summary
25905  * from .._linear_algebra.matrix_utilities import get_data_type_name, get_nnz, \ # <<<<<<<<<<<<<<
25906  * get_density
25907  *
25908  */
25909  __Pyx_TraceLine(25,0,__PYX_ERR(0, 25, __pyx_L1_error))
25910  __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25911  __Pyx_GOTREF(__pyx_t_1);
25912  __Pyx_INCREF(__pyx_n_s_get_data_type_name);
25913  __Pyx_GIVEREF(__pyx_n_s_get_data_type_name);
25914  PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_data_type_name);
25915  __Pyx_INCREF(__pyx_n_s_get_nnz);
25916  __Pyx_GIVEREF(__pyx_n_s_get_nnz);
25917  PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_get_nnz);
25918  __Pyx_INCREF(__pyx_n_s_get_density);
25919  __Pyx_GIVEREF(__pyx_n_s_get_density);
25920  PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_get_density);
25921  __pyx_t_2 = __Pyx_Import(__pyx_n_s_linear_algebra_matrix_utilities, __pyx_t_1, 2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error)
25922  __Pyx_GOTREF(__pyx_t_2);
25923  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25924  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_data_type_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25925  __Pyx_GOTREF(__pyx_t_1);
25926  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_data_type_name, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
25927  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25928  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_nnz); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25929  __Pyx_GOTREF(__pyx_t_1);
25930  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_nnz, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error)
25931  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25932  __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_density); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error)
25933  __Pyx_GOTREF(__pyx_t_1);
25934  if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_density, __pyx_t_1) < 0) __PYX_ERR(0, 26, __pyx_L1_error)
25935  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
25936  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25937 
25938  /* "imate/traceinv/_hutchinson_method.pyx":37
25939  * # =================
25940  *
25941  * def hutchinson_method( # <<<<<<<<<<<<<<
25942  * A,
25943  * gram=False,
25944  */
25945  __Pyx_TraceLine(37,0,__PYX_ERR(0, 37, __pyx_L1_error))
25946  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_1hutchinson_method, 0, __pyx_n_s_hutchinson_method, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
25947  __Pyx_GOTREF(__pyx_t_2);
25948  __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_tuple__28);
25949  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method, __pyx_t_2) < 0) __PYX_ERR(0, 37, __pyx_L1_error)
25950  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25951 
25952  /* "imate/traceinv/_hutchinson_method.pyx":741
25953  * # =======================
25954  *
25955  * def _hutchinson_method_float( # <<<<<<<<<<<<<<
25956  * A,
25957  * B,
25958  */
25959  __Pyx_TraceLine(741,0,__PYX_ERR(0, 741, __pyx_L1_error))
25960  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_3_hutchinson_method_float, 0, __pyx_n_s_hutchinson_method_float, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 741, __pyx_L1_error)
25961  __Pyx_GOTREF(__pyx_t_2);
25962  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method_float, __pyx_t_2) < 0) __PYX_ERR(0, 741, __pyx_L1_error)
25963  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25964 
25965  /* "imate/traceinv/_hutchinson_method.pyx":839
25966  * # ========================
25967  *
25968  * def _hutchinson_method_double( # <<<<<<<<<<<<<<
25969  * A,
25970  * B,
25971  */
25972  __Pyx_TraceLine(839,0,__PYX_ERR(0, 839, __pyx_L1_error))
25973  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_5_hutchinson_method_double, 0, __pyx_n_s_hutchinson_method_double, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__5)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 839, __pyx_L1_error)
25974  __Pyx_GOTREF(__pyx_t_2);
25975  if (PyDict_SetItem(__pyx_d, __pyx_n_s_hutchinson_method_double, __pyx_t_2) < 0) __PYX_ERR(0, 839, __pyx_L1_error)
25976  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
25977 
25978  /* "imate/traceinv/_hutchinson_method.pyx":937
25979  * # ================================
25980  *
25981  * cdef float _stochastic_trace_estimator_float( # <<<<<<<<<<<<<<
25982  * A,
25983  * AtA,
25984  */
25985  __Pyx_TraceLine(937,0,__PYX_ERR(0, 937, __pyx_L1_error))
25986 
25987 
25988  /* "imate/traceinv/_hutchinson_method.pyx":1016
25989  * # =================================
25990  *
25991  * cdef double _stochastic_trace_estimator_double( # <<<<<<<<<<<<<<
25992  * A,
25993  * AtA,
25994  */
25995  __Pyx_TraceLine(1016,0,__PYX_ERR(0, 1016, __pyx_L1_error))
25996 
25997 
25998  /* "imate/traceinv/_hutchinson_method.pyx":1095
25999  * # ============
26000  *
26001  * def _operator_dot(A, AtA, p, gram, assume_matrix, solver_tol, B, E): # <<<<<<<<<<<<<<
26002  * """
26003  * Computes either of the followings:
26004  */
26005  __Pyx_TraceLine(1095,0,__PYX_ERR(0, 1095, __pyx_L1_error))
26006  __pyx_t_2 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_8traceinv_18_hutchinson_method_7_operator_dot, 0, __pyx_n_s_operator_dot, NULL, __pyx_n_s_imate_traceinv__hutchinson_metho_2, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1095, __pyx_L1_error)
26007  __Pyx_GOTREF(__pyx_t_2);
26008  if (PyDict_SetItem(__pyx_d, __pyx_n_s_operator_dot, __pyx_t_2) < 0) __PYX_ERR(0, 1095, __pyx_L1_error)
26009  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26010 
26011  /* "imate/traceinv/_hutchinson_method.pyx":1
26012  * # SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu> # <<<<<<<<<<<<<<
26013  * # SPDX-License-Identifier: BSD-3-Clause
26014  * # SPDX-FileType: SOURCE
26015  */
26016  __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
26017  __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
26018  __Pyx_GOTREF(__pyx_t_2);
26019  if (PyDict_SetItem(__pyx_t_2, __pyx_kp_u_hutchinson_method_line_37, __pyx_kp_u_Trace_of_matrix_or_linear_opera) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
26020  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
26021  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26022 
26023  /* "View.MemoryView":210
26024  * info.obj = self
26025  *
26026  * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
26027  *
26028  * def __dealloc__(array self):
26029  */
26030  __Pyx_TraceLine(210,0,__PYX_ERR(1, 210, __pyx_L1_error))
26031  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 210, __pyx_L1_error)
26032  __Pyx_GOTREF(__pyx_t_2);
26033  if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 210, __pyx_L1_error)
26034  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26035  PyType_Modified(__pyx_array_type);
26036 
26037  /* "View.MemoryView":227
26038  *
26039  * @cname('get_memview')
26040  * cdef get_memview(self): # <<<<<<<<<<<<<<
26041  * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
26042  * return memoryview(self, flags, self.dtype_is_object)
26043  */
26044  __Pyx_TraceLine(227,0,__PYX_ERR(1, 227, __pyx_L1_error))
26045 
26046 
26047  /* "View.MemoryView":245
26048  *
26049  * @cname("__pyx_array_new")
26050  * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
26051  * char *mode, char *buf):
26052  * cdef array result
26053  */
26054  __Pyx_TraceLine(245,0,__PYX_ERR(1, 245, __pyx_L1_error))
26055 
26056 
26057  /* "View.MemoryView":287
26058  * return self.name
26059  *
26060  * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
26061  * cdef strided = Enum("<strided and direct>") # default
26062  * cdef indirect = Enum("<strided and indirect>")
26063  */
26064  __Pyx_TraceLine(287,0,__PYX_ERR(1, 287, __pyx_L1_error))
26065  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 287, __pyx_L1_error)
26066  __Pyx_GOTREF(__pyx_t_2);
26067  __Pyx_XGOTREF(generic);
26068  __Pyx_DECREF_SET(generic, __pyx_t_2);
26069  __Pyx_GIVEREF(__pyx_t_2);
26070  __pyx_t_2 = 0;
26071 
26072  /* "View.MemoryView":288
26073  *
26074  * cdef generic = Enum("<strided and direct or indirect>")
26075  * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
26076  * cdef indirect = Enum("<strided and indirect>")
26077  *
26078  */
26079  __Pyx_TraceLine(288,0,__PYX_ERR(1, 288, __pyx_L1_error))
26080  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 288, __pyx_L1_error)
26081  __Pyx_GOTREF(__pyx_t_2);
26082  __Pyx_XGOTREF(strided);
26083  __Pyx_DECREF_SET(strided, __pyx_t_2);
26084  __Pyx_GIVEREF(__pyx_t_2);
26085  __pyx_t_2 = 0;
26086 
26087  /* "View.MemoryView":289
26088  * cdef generic = Enum("<strided and direct or indirect>")
26089  * cdef strided = Enum("<strided and direct>") # default
26090  * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
26091  *
26092  *
26093  */
26094  __Pyx_TraceLine(289,0,__PYX_ERR(1, 289, __pyx_L1_error))
26095  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 289, __pyx_L1_error)
26096  __Pyx_GOTREF(__pyx_t_2);
26097  __Pyx_XGOTREF(indirect);
26098  __Pyx_DECREF_SET(indirect, __pyx_t_2);
26099  __Pyx_GIVEREF(__pyx_t_2);
26100  __pyx_t_2 = 0;
26101 
26102  /* "View.MemoryView":292
26103  *
26104  *
26105  * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
26106  * cdef indirect_contiguous = Enum("<contiguous and indirect>")
26107  *
26108  */
26109  __Pyx_TraceLine(292,0,__PYX_ERR(1, 292, __pyx_L1_error))
26110  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 292, __pyx_L1_error)
26111  __Pyx_GOTREF(__pyx_t_2);
26112  __Pyx_XGOTREF(contiguous);
26113  __Pyx_DECREF_SET(contiguous, __pyx_t_2);
26114  __Pyx_GIVEREF(__pyx_t_2);
26115  __pyx_t_2 = 0;
26116 
26117  /* "View.MemoryView":293
26118  *
26119  * cdef contiguous = Enum("<contiguous and direct>")
26120  * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
26121  *
26122  *
26123  */
26124  __Pyx_TraceLine(293,0,__PYX_ERR(1, 293, __pyx_L1_error))
26125  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 293, __pyx_L1_error)
26126  __Pyx_GOTREF(__pyx_t_2);
26127  __Pyx_XGOTREF(indirect_contiguous);
26128  __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_2);
26129  __Pyx_GIVEREF(__pyx_t_2);
26130  __pyx_t_2 = 0;
26131 
26132  /* "View.MemoryView":299
26133  *
26134  * @cname('__pyx_align_pointer')
26135  * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
26136  * "Align pointer memory on a given boundary"
26137  * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
26138  */
26139  __Pyx_TraceLine(299,0,__PYX_ERR(1, 299, __pyx_L1_error))
26140 
26141 
26142  /* "View.MemoryView":317
26143  *
26144  * DEF THREAD_LOCKS_PREALLOCATED = 8
26145  * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
26146  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
26147  * PyThread_allocate_lock(),
26148  */
26149  __Pyx_TraceLine(317,0,__PYX_ERR(1, 317, __pyx_L1_error))
26150  __pyx_memoryview_thread_locks_used = 0;
26151 
26152  /* "View.MemoryView":318
26153  * DEF THREAD_LOCKS_PREALLOCATED = 8
26154  * cdef int __pyx_memoryview_thread_locks_used = 0
26155  * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
26156  * PyThread_allocate_lock(),
26157  * PyThread_allocate_lock(),
26158  */
26159  __Pyx_TraceLine(318,0,__PYX_ERR(1, 318, __pyx_L1_error))
26160  __pyx_t_3[0] = PyThread_allocate_lock();
26161  __pyx_t_3[1] = PyThread_allocate_lock();
26162  __pyx_t_3[2] = PyThread_allocate_lock();
26163  __pyx_t_3[3] = PyThread_allocate_lock();
26164  __pyx_t_3[4] = PyThread_allocate_lock();
26165  __pyx_t_3[5] = PyThread_allocate_lock();
26166  __pyx_t_3[6] = PyThread_allocate_lock();
26167  __pyx_t_3[7] = PyThread_allocate_lock();
26168  memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_3, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
26169 
26170  /* "View.MemoryView":395
26171  * PyThread_free_lock(self.lock)
26172  *
26173  * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
26174  * cdef Py_ssize_t dim
26175  * cdef char *itemp = <char *> self.view.buf
26176  */
26177  __Pyx_TraceLine(395,0,__PYX_ERR(1, 395, __pyx_L1_error))
26178 
26179 
26180  /* "View.MemoryView":433
26181  * self.setitem_indexed(index, value)
26182  *
26183  * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
26184  * if not isinstance(obj, memoryview):
26185  * try:
26186  */
26187  __Pyx_TraceLine(433,0,__PYX_ERR(1, 433, __pyx_L1_error))
26188 
26189 
26190  /* "View.MemoryView":443
26191  * return obj
26192  *
26193  * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
26194  * cdef __Pyx_memviewslice dst_slice
26195  * cdef __Pyx_memviewslice src_slice
26196  */
26197  __Pyx_TraceLine(443,0,__PYX_ERR(1, 443, __pyx_L1_error))
26198 
26199 
26200  /* "View.MemoryView":451
26201  * src.ndim, dst.ndim, self.dtype_is_object)
26202  *
26203  * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
26204  * cdef int array[128]
26205  * cdef void *tmp = NULL
26206  */
26207  __Pyx_TraceLine(451,0,__PYX_ERR(1, 451, __pyx_L1_error))
26208 
26209 
26210  /* "View.MemoryView":483
26211  * PyMem_Free(tmp)
26212  *
26213  * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
26214  * cdef char *itemp = self.get_item_pointer(index)
26215  * self.assign_item_from_object(itemp, value)
26216  */
26217  __Pyx_TraceLine(483,0,__PYX_ERR(1, 483, __pyx_L1_error))
26218 
26219 
26220  /* "View.MemoryView":487
26221  * self.assign_item_from_object(itemp, value)
26222  *
26223  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
26224  * """Only used if instantiated manually by the user, or if Cython doesn't
26225  * know how to convert the type"""
26226  */
26227  __Pyx_TraceLine(487,0,__PYX_ERR(1, 487, __pyx_L1_error))
26228 
26229 
26230  /* "View.MemoryView":503
26231  * return result
26232  *
26233  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
26234  * """Only used if instantiated manually by the user, or if Cython doesn't
26235  * know how to convert the type"""
26236  */
26237  __Pyx_TraceLine(503,0,__PYX_ERR(1, 503, __pyx_L1_error))
26238 
26239 
26240  /* "View.MemoryView":551
26241  * info.obj = self
26242  *
26243  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
26244  *
26245  *
26246  */
26247  __Pyx_TraceLine(551,0,__PYX_ERR(1, 551, __pyx_L1_error))
26248  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 551, __pyx_L1_error)
26249  __Pyx_GOTREF(__pyx_t_2);
26250  if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 551, __pyx_L1_error)
26251  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26252  PyType_Modified(__pyx_memoryview_type);
26253 
26254  /* "View.MemoryView":659
26255  *
26256  * @cname('__pyx_memoryview_new')
26257  * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
26258  * cdef memoryview result = memoryview(o, flags, dtype_is_object)
26259  * result.typeinfo = typeinfo
26260  */
26261  __Pyx_TraceLine(659,0,__PYX_ERR(1, 659, __pyx_L1_error))
26262 
26263 
26264  /* "View.MemoryView":665
26265  *
26266  * @cname('__pyx_memoryview_check')
26267  * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
26268  * return isinstance(o, memoryview)
26269  *
26270  */
26271  __Pyx_TraceLine(665,0,__PYX_ERR(1, 665, __pyx_L1_error))
26272 
26273 
26274  /* "View.MemoryView":668
26275  * return isinstance(o, memoryview)
26276  *
26277  * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
26278  * """
26279  * Replace all ellipses with full slices and fill incomplete indices with
26280  */
26281  __Pyx_TraceLine(668,0,__PYX_ERR(1, 668, __pyx_L1_error))
26282 
26283 
26284  /* "View.MemoryView":702
26285  * return have_slices or nslices, tuple(result)
26286  *
26287  * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
26288  * for suboffset in suboffsets[:ndim]:
26289  * if suboffset >= 0:
26290  */
26291  __Pyx_TraceLine(702,0,__PYX_ERR(1, 702, __pyx_L1_error))
26292 
26293 
26294  /* "View.MemoryView":712
26295  *
26296  * @cname('__pyx_memview_slice')
26297  * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
26298  * cdef int new_ndim = 0, suboffset_dim = -1, dim
26299  * cdef bint negative_step
26300  */
26301  __Pyx_TraceLine(712,0,__PYX_ERR(1, 712, __pyx_L1_error))
26302 
26303 
26304  /* "View.MemoryView":809
26305  *
26306  * @cname('__pyx_memoryview_slice_memviewslice')
26307  * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
26308  * __Pyx_memviewslice *dst,
26309  * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
26310  */
26311  __Pyx_TraceLine(809,0,__PYX_ERR(1, 809, __pyx_L1_error))
26312 
26313 
26314  /* "View.MemoryView":912
26315  *
26316  * @cname('__pyx_pybuffer_index')
26317  * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
26318  * Py_ssize_t dim) except NULL:
26319  * cdef Py_ssize_t shape, stride, suboffset = -1
26320  */
26321  __Pyx_TraceLine(912,0,__PYX_ERR(1, 912, __pyx_L1_error))
26322 
26323 
26324  /* "View.MemoryView":945
26325  *
26326  * @cname('__pyx_memslice_transpose')
26327  * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
26328  * cdef int ndim = memslice.memview.view.ndim
26329  *
26330  */
26331  __Pyx_TraceLine(945,0,__PYX_ERR(1, 945, __pyx_L1_error))
26332 
26333 
26334  /* "View.MemoryView":981
26335  * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
26336  *
26337  * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
26338  * if self.to_object_func != NULL:
26339  * return self.to_object_func(itemp)
26340  */
26341  __Pyx_TraceLine(981,0,__PYX_ERR(1, 981, __pyx_L1_error))
26342 
26343 
26344  /* "View.MemoryView":987
26345  * return memoryview.convert_item_to_object(self, itemp)
26346  *
26347  * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
26348  * if self.to_dtype_func != NULL:
26349  * self.to_dtype_func(itemp, value)
26350  */
26351  __Pyx_TraceLine(987,0,__PYX_ERR(1, 987, __pyx_L1_error))
26352 
26353 
26354  /* "View.MemoryView":997
26355  * return self.from_object
26356  *
26357  * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
26358  *
26359  *
26360  */
26361  __Pyx_TraceLine(997,0,__PYX_ERR(1, 997, __pyx_L1_error))
26362  __pyx_t_2 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 997, __pyx_L1_error)
26363  __Pyx_GOTREF(__pyx_t_2);
26364  if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_2) < 0) __PYX_ERR(1, 997, __pyx_L1_error)
26365  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26366  PyType_Modified(__pyx_memoryviewslice_type);
26367 
26368  /* "View.MemoryView":1001
26369  *
26370  * @cname('__pyx_memoryview_fromslice')
26371  * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
26372  * int ndim,
26373  * object (*to_object_func)(char *),
26374  */
26375  __Pyx_TraceLine(1001,0,__PYX_ERR(1, 1001, __pyx_L1_error))
26376 
26377 
26378  /* "View.MemoryView":1054
26379  *
26380  * @cname('__pyx_memoryview_get_slice_from_memoryview')
26381  * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
26382  * __Pyx_memviewslice *mslice) except NULL:
26383  * cdef _memoryviewslice obj
26384  */
26385  __Pyx_TraceLine(1054,0,__PYX_ERR(1, 1054, __pyx_L1_error))
26386 
26387 
26388  /* "View.MemoryView":1065
26389  *
26390  * @cname('__pyx_memoryview_slice_copy')
26391  * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
26392  * cdef int dim
26393  * cdef (Py_ssize_t*) shape, strides, suboffsets
26394  */
26395  __Pyx_TraceLine(1065,0,__PYX_ERR(1, 1065, __pyx_L1_error))
26396 
26397 
26398  /* "View.MemoryView":1082
26399  *
26400  * @cname('__pyx_memoryview_copy_object')
26401  * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
26402  * "Create a new memoryview object"
26403  * cdef __Pyx_memviewslice memviewslice
26404  */
26405  __Pyx_TraceLine(1082,0,__PYX_ERR(1, 1082, __pyx_L1_error))
26406 
26407 
26408  /* "View.MemoryView":1089
26409  *
26410  * @cname('__pyx_memoryview_copy_object_from_slice')
26411  * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
26412  * """
26413  * Create a new memoryview object from a given memoryview object and slice.
26414  */
26415  __Pyx_TraceLine(1089,0,__PYX_ERR(1, 1089, __pyx_L1_error))
26416 
26417 
26418  /* "View.MemoryView":1111
26419  *
26420  *
26421  * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
26422  * if arg < 0:
26423  * return -arg
26424  */
26425  __Pyx_TraceLine(1111,0,__PYX_ERR(1, 1111, __pyx_L1_error))
26426 
26427 
26428  /* "View.MemoryView":1118
26429  *
26430  * @cname('__pyx_get_best_slice_order')
26431  * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
26432  * """
26433  * Figure out the best memory access order for a given slice.
26434  */
26435  __Pyx_TraceLine(1118,0,__PYX_ERR(1, 1118, __pyx_L1_error))
26436 
26437 
26438  /* "View.MemoryView":1172
26439  * dst_data += dst_stride
26440  *
26441  * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
26442  * __Pyx_memviewslice *dst,
26443  * int ndim, size_t itemsize) nogil:
26444  */
26445  __Pyx_TraceLine(1172,0,__PYX_ERR(1, 1172, __pyx_L1_error))
26446 
26447 
26448  /* "View.MemoryView":1179
26449  *
26450  * @cname('__pyx_memoryview_slice_get_size')
26451  * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
26452  * "Return the size of the memory occupied by the slice in number of bytes"
26453  * cdef Py_ssize_t shape, size = src.memview.view.itemsize
26454  */
26455  __Pyx_TraceLine(1179,0,__PYX_ERR(1, 1179, __pyx_L1_error))
26456 
26457 
26458  /* "View.MemoryView":1189
26459  *
26460  * @cname('__pyx_fill_contig_strides_array')
26461  * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
26462  * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
26463  * int ndim, char order) nogil:
26464  */
26465  __Pyx_TraceLine(1189,0,__PYX_ERR(1, 1189, __pyx_L1_error))
26466 
26467 
26468  /* "View.MemoryView":1210
26469  *
26470  * @cname('__pyx_memoryview_copy_data_to_temp')
26471  * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
26472  * __Pyx_memviewslice *tmpslice,
26473  * char order,
26474  */
26475  __Pyx_TraceLine(1210,0,__PYX_ERR(1, 1210, __pyx_L1_error))
26476 
26477 
26478  /* "View.MemoryView":1253
26479  *
26480  * @cname('__pyx_memoryview_err_extents')
26481  * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
26482  * Py_ssize_t extent2) except -1 with gil:
26483  * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
26484  */
26485  __Pyx_TraceLine(1253,0,__PYX_ERR(1, 1253, __pyx_L1_error))
26486 
26487 
26488  /* "View.MemoryView":1259
26489  *
26490  * @cname('__pyx_memoryview_err_dim')
26491  * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
26492  * raise error(msg.decode('ascii') % dim)
26493  *
26494  */
26495  __Pyx_TraceLine(1259,0,__PYX_ERR(1, 1259, __pyx_L1_error))
26496 
26497 
26498  /* "View.MemoryView":1263
26499  *
26500  * @cname('__pyx_memoryview_err')
26501  * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
26502  * if msg != NULL:
26503  * raise error(msg.decode('ascii'))
26504  */
26505  __Pyx_TraceLine(1263,0,__PYX_ERR(1, 1263, __pyx_L1_error))
26506 
26507 
26508  /* "View.MemoryView":1270
26509  *
26510  * @cname('__pyx_memoryview_copy_contents')
26511  * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
26512  * __Pyx_memviewslice dst,
26513  * int src_ndim, int dst_ndim,
26514  */
26515  __Pyx_TraceLine(1270,0,__PYX_ERR(1, 1270, __pyx_L1_error))
26516 
26517 
26518  /* "View.MemoryView":1342
26519  *
26520  * @cname('__pyx_memoryview_broadcast_leading')
26521  * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
26522  * int ndim,
26523  * int ndim_other) nogil:
26524  */
26525  __Pyx_TraceLine(1342,0,__PYX_ERR(1, 1342, __pyx_L1_error))
26526 
26527 
26528  /* "View.MemoryView":1364
26529  *
26530  * @cname('__pyx_memoryview_refcount_copying')
26531  * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
26532  * int ndim, bint inc) nogil:
26533  *
26534  */
26535  __Pyx_TraceLine(1364,0,__PYX_ERR(1, 1364, __pyx_L1_error))
26536 
26537 
26538  /* "View.MemoryView":1373
26539  *
26540  * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
26541  * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
26542  * Py_ssize_t *strides, int ndim,
26543  * bint inc) with gil:
26544  */
26545  __Pyx_TraceLine(1373,0,__PYX_ERR(1, 1373, __pyx_L1_error))
26546 
26547 
26548  /* "View.MemoryView":1379
26549  *
26550  * @cname('__pyx_memoryview_refcount_objects_in_slice')
26551  * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
26552  * Py_ssize_t *strides, int ndim, bint inc):
26553  * cdef Py_ssize_t i
26554  */
26555  __Pyx_TraceLine(1379,0,__PYX_ERR(1, 1379, __pyx_L1_error))
26556 
26557 
26558  /* "View.MemoryView":1399
26559  *
26560  * @cname('__pyx_memoryview_slice_assign_scalar')
26561  * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
26562  * size_t itemsize, void *item,
26563  * bint dtype_is_object) nogil:
26564  */
26565  __Pyx_TraceLine(1399,0,__PYX_ERR(1, 1399, __pyx_L1_error))
26566 
26567 
26568  /* "View.MemoryView":1409
26569  *
26570  * @cname('__pyx_memoryview__slice_assign_scalar')
26571  * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
26572  * Py_ssize_t *strides, int ndim,
26573  * size_t itemsize, void *item) nogil:
26574  */
26575  __Pyx_TraceLine(1409,0,__PYX_ERR(1, 1409, __pyx_L1_error))
26576 
26577 
26578  /* "(tree fragment)":1
26579  * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
26580  * cdef object __pyx_PickleError
26581  * cdef object __pyx_result
26582  */
26583  __Pyx_TraceLine(1,0,__PYX_ERR(1, 1, __pyx_L1_error))
26584  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error)
26585  __Pyx_GOTREF(__pyx_t_2);
26586  if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
26587  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
26588 
26589  /* "(tree fragment)":11
26590  * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
26591  * return __pyx_result
26592  * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
26593  * __pyx_result.name = __pyx_state[0]
26594  * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
26595  */
26596  __Pyx_TraceLine(11,0,__PYX_ERR(1, 11, __pyx_L1_error))
26597 
26598  __Pyx_TraceReturn(Py_None, 0);
26599 
26600  /*--- Wrapped vars code ---*/
26601 
26602  goto __pyx_L0;
26603  __pyx_L1_error:;
26604  __Pyx_XDECREF(__pyx_t_1);
26605  __Pyx_XDECREF(__pyx_t_2);
26606  if (__pyx_m) {
26607  if (__pyx_d) {
26608  __Pyx_AddTraceback("init imate.traceinv._hutchinson_method", __pyx_clineno, __pyx_lineno, __pyx_filename);
26609  }
26610  Py_CLEAR(__pyx_m);
26611  } else if (!PyErr_Occurred()) {
26612  PyErr_SetString(PyExc_ImportError, "init imate.traceinv._hutchinson_method");
26613  }
26614  __pyx_L0:;
26615  __Pyx_RefNannyFinishContext();
26616  #if CYTHON_PEP489_MULTI_PHASE_INIT
26617  return (__pyx_m != NULL) ? 0 : -1;
26618  #elif PY_MAJOR_VERSION >= 3
26619  return __pyx_m;
26620  #else
26621  return;
26622  #endif
26623 }
26624 
26625 /* --- Runtime support code --- */
26626 /* Refnanny */
26627 #if CYTHON_REFNANNY
26628 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
26629  PyObject *m = NULL, *p = NULL;
26630  void *r = NULL;
26631  m = PyImport_ImportModule(modname);
26632  if (!m) goto end;
26633  p = PyObject_GetAttrString(m, "RefNannyAPI");
26634  if (!p) goto end;
26635  r = PyLong_AsVoidPtr(p);
26636 end:
26637  Py_XDECREF(p);
26638  Py_XDECREF(m);
26639  return (__Pyx_RefNannyAPIStruct *)r;
26640 }
26641 #endif
26642 
26643 /* PyObjectGetAttrStr */
26644 #if CYTHON_USE_TYPE_SLOTS
26645 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
26646  PyTypeObject* tp = Py_TYPE(obj);
26647  if (likely(tp->tp_getattro))
26648  return tp->tp_getattro(obj, attr_name);
26649 #if PY_MAJOR_VERSION < 3
26650  if (likely(tp->tp_getattr))
26651  return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
26652 #endif
26653  return PyObject_GetAttr(obj, attr_name);
26654 }
26655 #endif
26656 
26657 /* GetBuiltinName */
26658 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
26659  PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
26660  if (unlikely(!result)) {
26661  PyErr_Format(PyExc_NameError,
26662 #if PY_MAJOR_VERSION >= 3
26663  "name '%U' is not defined", name);
26664 #else
26665  "name '%.200s' is not defined", PyString_AS_STRING(name));
26666 #endif
26667  }
26668  return result;
26669 }
26670 
26671 /* RaiseDoubleKeywords */
26672 static void __Pyx_RaiseDoubleKeywordsError(
26673  const char* func_name,
26674  PyObject* kw_name)
26675 {
26676  PyErr_Format(PyExc_TypeError,
26677  #if PY_MAJOR_VERSION >= 3
26678  "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
26679  #else
26680  "%s() got multiple values for keyword argument '%s'", func_name,
26681  PyString_AsString(kw_name));
26682  #endif
26683 }
26684 
26685 /* ParseKeywords */
26686 static int __Pyx_ParseOptionalKeywords(
26687  PyObject *kwds,
26688  PyObject **argnames[],
26689  PyObject *kwds2,
26690  PyObject *values[],
26691  Py_ssize_t num_pos_args,
26692  const char* function_name)
26693 {
26694  PyObject *key = 0, *value = 0;
26695  Py_ssize_t pos = 0;
26696  PyObject*** name;
26697  PyObject*** first_kw_arg = argnames + num_pos_args;
26698  while (PyDict_Next(kwds, &pos, &key, &value)) {
26699  name = first_kw_arg;
26700  while (*name && (**name != key)) name++;
26701  if (*name) {
26702  values[name-argnames] = value;
26703  continue;
26704  }
26705  name = first_kw_arg;
26706  #if PY_MAJOR_VERSION < 3
26707  if (likely(PyString_Check(key))) {
26708  while (*name) {
26709  if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
26710  && _PyString_Eq(**name, key)) {
26711  values[name-argnames] = value;
26712  break;
26713  }
26714  name++;
26715  }
26716  if (*name) continue;
26717  else {
26718  PyObject*** argname = argnames;
26719  while (argname != first_kw_arg) {
26720  if ((**argname == key) || (
26721  (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
26722  && _PyString_Eq(**argname, key))) {
26723  goto arg_passed_twice;
26724  }
26725  argname++;
26726  }
26727  }
26728  } else
26729  #endif
26730  if (likely(PyUnicode_Check(key))) {
26731  while (*name) {
26732  int cmp = (**name == key) ? 0 :
26733  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
26734  (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
26735  #endif
26736  PyUnicode_Compare(**name, key);
26737  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
26738  if (cmp == 0) {
26739  values[name-argnames] = value;
26740  break;
26741  }
26742  name++;
26743  }
26744  if (*name) continue;
26745  else {
26746  PyObject*** argname = argnames;
26747  while (argname != first_kw_arg) {
26748  int cmp = (**argname == key) ? 0 :
26749  #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
26750  (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
26751  #endif
26752  PyUnicode_Compare(**argname, key);
26753  if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
26754  if (cmp == 0) goto arg_passed_twice;
26755  argname++;
26756  }
26757  }
26758  } else
26759  goto invalid_keyword_type;
26760  if (kwds2) {
26761  if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
26762  } else {
26763  goto invalid_keyword;
26764  }
26765  }
26766  return 0;
26767 arg_passed_twice:
26768  __Pyx_RaiseDoubleKeywordsError(function_name, key);
26769  goto bad;
26770 invalid_keyword_type:
26771  PyErr_Format(PyExc_TypeError,
26772  "%.200s() keywords must be strings", function_name);
26773  goto bad;
26774 invalid_keyword:
26775  PyErr_Format(PyExc_TypeError,
26776  #if PY_MAJOR_VERSION < 3
26777  "%.200s() got an unexpected keyword argument '%.200s'",
26778  function_name, PyString_AsString(key));
26779  #else
26780  "%s() got an unexpected keyword argument '%U'",
26781  function_name, key);
26782  #endif
26783 bad:
26784  return -1;
26785 }
26786 
26787 /* RaiseArgTupleInvalid */
26788 static void __Pyx_RaiseArgtupleInvalid(
26789  const char* func_name,
26790  int exact,
26791  Py_ssize_t num_min,
26792  Py_ssize_t num_max,
26793  Py_ssize_t num_found)
26794 {
26795  Py_ssize_t num_expected;
26796  const char *more_or_less;
26797  if (num_found < num_min) {
26798  num_expected = num_min;
26799  more_or_less = "at least";
26800  } else {
26801  num_expected = num_max;
26802  more_or_less = "at most";
26803  }
26804  if (exact) {
26805  more_or_less = "exactly";
26806  }
26807  PyErr_Format(PyExc_TypeError,
26808  "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
26809  func_name, more_or_less, num_expected,
26810  (num_expected == 1) ? "" : "s", num_found);
26811 }
26812 
26813 /* PyErrFetchRestore */
26814 #if CYTHON_FAST_THREAD_STATE
26815 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
26816  PyObject *tmp_type, *tmp_value, *tmp_tb;
26817  tmp_type = tstate->curexc_type;
26818  tmp_value = tstate->curexc_value;
26819  tmp_tb = tstate->curexc_traceback;
26820  tstate->curexc_type = type;
26821  tstate->curexc_value = value;
26822  tstate->curexc_traceback = tb;
26823  Py_XDECREF(tmp_type);
26824  Py_XDECREF(tmp_value);
26825  Py_XDECREF(tmp_tb);
26826 }
26827 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
26828  *type = tstate->curexc_type;
26829  *value = tstate->curexc_value;
26830  *tb = tstate->curexc_traceback;
26831  tstate->curexc_type = 0;
26832  tstate->curexc_value = 0;
26833  tstate->curexc_traceback = 0;
26834 }
26835 #endif
26836 
26837 /* Profile */
26838 #if CYTHON_PROFILE
26839 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
26840  PyFrameObject** frame,
26841  PyThreadState* tstate,
26842  const char *funcname,
26843  const char *srcfile,
26844  int firstlineno) {
26845  PyObject *type, *value, *traceback;
26846  int retval;
26847  if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
26848  if (*code == NULL) {
26849  *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
26850  if (*code == NULL) return 0;
26851  }
26852  *frame = PyFrame_New(
26853  tstate, /*PyThreadState *tstate*/
26854  *code, /*PyCodeObject *code*/
26855  __pyx_d, /*PyObject *globals*/
26856  0 /*PyObject *locals*/
26857  );
26858  if (*frame == NULL) return 0;
26859  if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
26860  Py_INCREF(Py_None);
26861  (*frame)->f_trace = Py_None;
26862  }
26863 #if PY_VERSION_HEX < 0x030400B1
26864  } else {
26865  (*frame)->f_tstate = tstate;
26866 #endif
26867  }
26868  __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
26869  retval = 1;
26870  __Pyx_EnterTracing(tstate);
26871  __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
26872  #if CYTHON_TRACE
26873  if (tstate->c_tracefunc)
26874  retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
26875  if (retval && tstate->c_profilefunc)
26876  #endif
26877  retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
26878  __Pyx_LeaveTracing(tstate);
26879  if (retval) {
26880  __Pyx_ErrRestoreInState(tstate, type, value, traceback);
26881  return __Pyx_IsTracing(tstate, 0, 0) && retval;
26882  } else {
26883  Py_XDECREF(type);
26884  Py_XDECREF(value);
26885  Py_XDECREF(traceback);
26886  return -1;
26887  }
26888 }
26889 static PyCodeObject *__Pyx_createFrameCodeObject(const char *funcname, const char *srcfile, int firstlineno) {
26890  PyCodeObject *py_code = 0;
26891 #if PY_MAJOR_VERSION >= 3
26892  py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
26893  if (likely(py_code)) {
26894  py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
26895  }
26896 #else
26897  PyObject *py_srcfile = 0;
26898  PyObject *py_funcname = 0;
26899  py_funcname = PyString_FromString(funcname);
26900  if (unlikely(!py_funcname)) goto bad;
26901  py_srcfile = PyString_FromString(srcfile);
26902  if (unlikely(!py_srcfile)) goto bad;
26903  py_code = PyCode_New(
26904  0,
26905  0,
26906  0,
26907  CO_OPTIMIZED | CO_NEWLOCALS,
26908  __pyx_empty_bytes, /*PyObject *code,*/
26909  __pyx_empty_tuple, /*PyObject *consts,*/
26910  __pyx_empty_tuple, /*PyObject *names,*/
26911  __pyx_empty_tuple, /*PyObject *varnames,*/
26912  __pyx_empty_tuple, /*PyObject *freevars,*/
26913  __pyx_empty_tuple, /*PyObject *cellvars,*/
26914  py_srcfile, /*PyObject *filename,*/
26915  py_funcname, /*PyObject *name,*/
26916  firstlineno,
26917  __pyx_empty_bytes /*PyObject *lnotab*/
26918  );
26919 bad:
26920  Py_XDECREF(py_srcfile);
26921  Py_XDECREF(py_funcname);
26922 #endif
26923  return py_code;
26924 }
26925 #endif
26926 
26927 /* PyDictVersioning */
26928 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
26929 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
26930  PyObject *dict = Py_TYPE(obj)->tp_dict;
26931  return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
26932 }
26933 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
26934  PyObject **dictptr = NULL;
26935  Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
26936  if (offset) {
26937 #if CYTHON_COMPILING_IN_CPYTHON
26938  dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
26939 #else
26940  dictptr = _PyObject_GetDictPtr(obj);
26941 #endif
26942  }
26943  return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
26944 }
26945 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
26946  PyObject *dict = Py_TYPE(obj)->tp_dict;
26947  if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
26948  return 0;
26949  return obj_dict_version == __Pyx_get_object_dict_version(obj);
26950 }
26951 #endif
26952 
26953 /* GetModuleGlobalName */
26954 #if CYTHON_USE_DICT_VERSIONS
26955 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
26956 #else
26957 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
26958 #endif
26959 {
26960  PyObject *result;
26961 #if !CYTHON_AVOID_BORROWED_REFS
26962 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
26963  result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
26964  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26965  if (likely(result)) {
26966  return __Pyx_NewRef(result);
26967  } else if (unlikely(PyErr_Occurred())) {
26968  return NULL;
26969  }
26970 #else
26971  result = PyDict_GetItem(__pyx_d, name);
26972  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26973  if (likely(result)) {
26974  return __Pyx_NewRef(result);
26975  }
26976 #endif
26977 #else
26978  result = PyObject_GetItem(__pyx_d, name);
26979  __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
26980  if (likely(result)) {
26981  return __Pyx_NewRef(result);
26982  }
26983  PyErr_Clear();
26984 #endif
26985  return __Pyx_GetBuiltinName(name);
26986 }
26987 
26988 /* PyFunctionFastCall */
26989 #if CYTHON_FAST_PYCALL
26990 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
26991  PyObject *globals) {
26992  PyFrameObject *f;
26993  PyThreadState *tstate = __Pyx_PyThreadState_Current;
26994  PyObject **fastlocals;
26995  Py_ssize_t i;
26996  PyObject *result;
26997  assert(globals != NULL);
26998  /* XXX Perhaps we should create a specialized
26999  PyFrame_New() that doesn't take locals, but does
27000  take builtins without sanity checking them.
27001  */
27002  assert(tstate != NULL);
27003  f = PyFrame_New(tstate, co, globals, NULL);
27004  if (f == NULL) {
27005  return NULL;
27006  }
27007  fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
27008  for (i = 0; i < na; i++) {
27009  Py_INCREF(*args);
27010  fastlocals[i] = *args++;
27011  }
27012  result = PyEval_EvalFrameEx(f,0);
27013  ++tstate->recursion_depth;
27014  Py_DECREF(f);
27015  --tstate->recursion_depth;
27016  return result;
27017 }
27018 #if 1 || PY_VERSION_HEX < 0x030600B1
27019 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
27020  PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
27021  PyObject *globals = PyFunction_GET_GLOBALS(func);
27022  PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
27023  PyObject *closure;
27024 #if PY_MAJOR_VERSION >= 3
27025  PyObject *kwdefs;
27026 #endif
27027  PyObject *kwtuple, **k;
27028  PyObject **d;
27029  Py_ssize_t nd;
27030  Py_ssize_t nk;
27031  PyObject *result;
27032  assert(kwargs == NULL || PyDict_Check(kwargs));
27033  nk = kwargs ? PyDict_Size(kwargs) : 0;
27034  if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
27035  return NULL;
27036  }
27037  if (
27038 #if PY_MAJOR_VERSION >= 3
27039  co->co_kwonlyargcount == 0 &&
27040 #endif
27041  likely(kwargs == NULL || nk == 0) &&
27042  co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
27043  if (argdefs == NULL && co->co_argcount == nargs) {
27044  result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
27045  goto done;
27046  }
27047  else if (nargs == 0 && argdefs != NULL
27048  && co->co_argcount == Py_SIZE(argdefs)) {
27049  /* function called with no arguments, but all parameters have
27050  a default value: use default values as arguments .*/
27051  args = &PyTuple_GET_ITEM(argdefs, 0);
27052  result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
27053  goto done;
27054  }
27055  }
27056  if (kwargs != NULL) {
27057  Py_ssize_t pos, i;
27058  kwtuple = PyTuple_New(2 * nk);
27059  if (kwtuple == NULL) {
27060  result = NULL;
27061  goto done;
27062  }
27063  k = &PyTuple_GET_ITEM(kwtuple, 0);
27064  pos = i = 0;
27065  while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
27066  Py_INCREF(k[i]);
27067  Py_INCREF(k[i+1]);
27068  i += 2;
27069  }
27070  nk = i / 2;
27071  }
27072  else {
27073  kwtuple = NULL;
27074  k = NULL;
27075  }
27076  closure = PyFunction_GET_CLOSURE(func);
27077 #if PY_MAJOR_VERSION >= 3
27078  kwdefs = PyFunction_GET_KW_DEFAULTS(func);
27079 #endif
27080  if (argdefs != NULL) {
27081  d = &PyTuple_GET_ITEM(argdefs, 0);
27082  nd = Py_SIZE(argdefs);
27083  }
27084  else {
27085  d = NULL;
27086  nd = 0;
27087  }
27088 #if PY_MAJOR_VERSION >= 3
27089  result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
27090  args, (int)nargs,
27091  k, (int)nk,
27092  d, (int)nd, kwdefs, closure);
27093 #else
27094  result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
27095  args, (int)nargs,
27096  k, (int)nk,
27097  d, (int)nd, closure);
27098 #endif
27099  Py_XDECREF(kwtuple);
27100 done:
27101  Py_LeaveRecursiveCall();
27102  return result;
27103 }
27104 #endif
27105 #endif
27106 
27107 /* PyCFunctionFastCall */
27108 #if CYTHON_FAST_PYCCALL
27109 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
27110  PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
27111  PyCFunction meth = PyCFunction_GET_FUNCTION(func);
27112  PyObject *self = PyCFunction_GET_SELF(func);
27113  int flags = PyCFunction_GET_FLAGS(func);
27114  assert(PyCFunction_Check(func));
27115  assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
27116  assert(nargs >= 0);
27117  assert(nargs == 0 || args != NULL);
27118  /* _PyCFunction_FastCallDict() must not be called with an exception set,
27119  because it may clear it (directly or indirectly) and so the
27120  caller loses its exception */
27121  assert(!PyErr_Occurred());
27122  if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
27123  return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
27124  } else {
27125  return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
27126  }
27127 }
27128 #endif
27129 
27130 /* PyObjectCall */
27131 #if CYTHON_COMPILING_IN_CPYTHON
27132 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
27133  PyObject *result;
27134  ternaryfunc call = Py_TYPE(func)->tp_call;
27135  if (unlikely(!call))
27136  return PyObject_Call(func, arg, kw);
27137  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
27138  return NULL;
27139  result = (*call)(func, arg, kw);
27140  Py_LeaveRecursiveCall();
27141  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
27142  PyErr_SetString(
27143  PyExc_SystemError,
27144  "NULL result without error in PyObject_Call");
27145  }
27146  return result;
27147 }
27148 #endif
27149 
27150 /* RaiseTooManyValuesToUnpack */
27151 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
27152  PyErr_Format(PyExc_ValueError,
27153  "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
27154 }
27155 
27156 /* RaiseNeedMoreValuesToUnpack */
27157 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
27158  PyErr_Format(PyExc_ValueError,
27159  "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
27160  index, (index == 1) ? "" : "s");
27161 }
27162 
27163 /* IterFinish */
27164 static CYTHON_INLINE int __Pyx_IterFinish(void) {
27165 #if CYTHON_FAST_THREAD_STATE
27166  PyThreadState *tstate = __Pyx_PyThreadState_Current;
27167  PyObject* exc_type = tstate->curexc_type;
27168  if (unlikely(exc_type)) {
27169  if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
27170  PyObject *exc_value, *exc_tb;
27171  exc_value = tstate->curexc_value;
27172  exc_tb = tstate->curexc_traceback;
27173  tstate->curexc_type = 0;
27174  tstate->curexc_value = 0;
27175  tstate->curexc_traceback = 0;
27176  Py_DECREF(exc_type);
27177  Py_XDECREF(exc_value);
27178  Py_XDECREF(exc_tb);
27179  return 0;
27180  } else {
27181  return -1;
27182  }
27183  }
27184  return 0;
27185 #else
27186  if (unlikely(PyErr_Occurred())) {
27187  if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
27188  PyErr_Clear();
27189  return 0;
27190  } else {
27191  return -1;
27192  }
27193  }
27194  return 0;
27195 #endif
27196 }
27197 
27198 /* UnpackItemEndCheck */
27199 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
27200  if (unlikely(retval)) {
27201  Py_DECREF(retval);
27202  __Pyx_RaiseTooManyValuesError(expected);
27203  return -1;
27204  }
27205  return __Pyx_IterFinish();
27206 }
27207 
27208 /* GetItemInt */
27209 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
27210  PyObject *r;
27211  if (!j) return NULL;
27212  r = PyObject_GetItem(o, j);
27213  Py_DECREF(j);
27214  return r;
27215 }
27216 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
27217  CYTHON_NCP_UNUSED int wraparound,
27218  CYTHON_NCP_UNUSED int boundscheck) {
27219 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27220  Py_ssize_t wrapped_i = i;
27221  if (wraparound & unlikely(i < 0)) {
27222  wrapped_i += PyList_GET_SIZE(o);
27223  }
27224  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
27225  PyObject *r = PyList_GET_ITEM(o, wrapped_i);
27226  Py_INCREF(r);
27227  return r;
27228  }
27229  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27230 #else
27231  return PySequence_GetItem(o, i);
27232 #endif
27233 }
27234 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
27235  CYTHON_NCP_UNUSED int wraparound,
27236  CYTHON_NCP_UNUSED int boundscheck) {
27237 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
27238  Py_ssize_t wrapped_i = i;
27239  if (wraparound & unlikely(i < 0)) {
27240  wrapped_i += PyTuple_GET_SIZE(o);
27241  }
27242  if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
27243  PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
27244  Py_INCREF(r);
27245  return r;
27246  }
27247  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27248 #else
27249  return PySequence_GetItem(o, i);
27250 #endif
27251 }
27252 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
27253  CYTHON_NCP_UNUSED int wraparound,
27254  CYTHON_NCP_UNUSED int boundscheck) {
27255 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
27256  if (is_list || PyList_CheckExact(o)) {
27257  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
27258  if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
27259  PyObject *r = PyList_GET_ITEM(o, n);
27260  Py_INCREF(r);
27261  return r;
27262  }
27263  }
27264  else if (PyTuple_CheckExact(o)) {
27265  Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
27266  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
27267  PyObject *r = PyTuple_GET_ITEM(o, n);
27268  Py_INCREF(r);
27269  return r;
27270  }
27271  } else {
27272  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
27273  if (likely(m && m->sq_item)) {
27274  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
27275  Py_ssize_t l = m->sq_length(o);
27276  if (likely(l >= 0)) {
27277  i += l;
27278  } else {
27279  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27280  return NULL;
27281  PyErr_Clear();
27282  }
27283  }
27284  return m->sq_item(o, i);
27285  }
27286  }
27287 #else
27288  if (is_list || PySequence_Check(o)) {
27289  return PySequence_GetItem(o, i);
27290  }
27291 #endif
27292  return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
27293 }
27294 
27295 /* PyObjectCallMethO */
27296 #if CYTHON_COMPILING_IN_CPYTHON
27297 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
27298  PyObject *self, *result;
27299  PyCFunction cfunc;
27300  cfunc = PyCFunction_GET_FUNCTION(func);
27301  self = PyCFunction_GET_SELF(func);
27302  if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
27303  return NULL;
27304  result = cfunc(self, arg);
27305  Py_LeaveRecursiveCall();
27306  if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
27307  PyErr_SetString(
27308  PyExc_SystemError,
27309  "NULL result without error in PyObject_Call");
27310  }
27311  return result;
27312 }
27313 #endif
27314 
27315 /* PyObjectCallNoArg */
27316 #if CYTHON_COMPILING_IN_CPYTHON
27317 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
27318 #if CYTHON_FAST_PYCALL
27319  if (PyFunction_Check(func)) {
27320  return __Pyx_PyFunction_FastCall(func, NULL, 0);
27321  }
27322 #endif
27323 #if defined(__Pyx_CyFunction_USED) && defined(NDEBUG)
27324  if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
27325 #else
27326  if (likely(PyCFunction_Check(func)))
27327 #endif
27328  {
27329  if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
27330  return __Pyx_PyObject_CallMethO(func, NULL);
27331  }
27332  }
27333  return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
27334 }
27335 #endif
27336 
27337 /* PyObjectCallOneArg */
27338 #if CYTHON_COMPILING_IN_CPYTHON
27339 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27340  PyObject *result;
27341  PyObject *args = PyTuple_New(1);
27342  if (unlikely(!args)) return NULL;
27343  Py_INCREF(arg);
27344  PyTuple_SET_ITEM(args, 0, arg);
27345  result = __Pyx_PyObject_Call(func, args, NULL);
27346  Py_DECREF(args);
27347  return result;
27348 }
27349 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27350 #if CYTHON_FAST_PYCALL
27351  if (PyFunction_Check(func)) {
27352  return __Pyx_PyFunction_FastCall(func, &arg, 1);
27353  }
27354 #endif
27355  if (likely(PyCFunction_Check(func))) {
27356  if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
27357  return __Pyx_PyObject_CallMethO(func, arg);
27358 #if CYTHON_FAST_PYCCALL
27359  } else if (__Pyx_PyFastCFunction_Check(func)) {
27360  return __Pyx_PyCFunction_FastCall(func, &arg, 1);
27361 #endif
27362  }
27363  }
27364  return __Pyx__PyObject_CallOneArg(func, arg);
27365 }
27366 #else
27367 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
27368  PyObject *result;
27369  PyObject *args = PyTuple_Pack(1, arg);
27370  if (unlikely(!args)) return NULL;
27371  result = __Pyx_PyObject_Call(func, args, NULL);
27372  Py_DECREF(args);
27373  return result;
27374 }
27375 #endif
27376 
27377 /* PyObjectCall2Args */
27378 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
27379  PyObject *args, *result = NULL;
27380  #if CYTHON_FAST_PYCALL
27381  if (PyFunction_Check(function)) {
27382  PyObject *args[2] = {arg1, arg2};
27383  return __Pyx_PyFunction_FastCall(function, args, 2);
27384  }
27385  #endif
27386  #if CYTHON_FAST_PYCCALL
27387  if (__Pyx_PyFastCFunction_Check(function)) {
27388  PyObject *args[2] = {arg1, arg2};
27389  return __Pyx_PyCFunction_FastCall(function, args, 2);
27390  }
27391  #endif
27392  args = PyTuple_New(2);
27393  if (unlikely(!args)) goto done;
27394  Py_INCREF(arg1);
27395  PyTuple_SET_ITEM(args, 0, arg1);
27396  Py_INCREF(arg2);
27397  PyTuple_SET_ITEM(args, 1, arg2);
27398  Py_INCREF(function);
27399  result = __Pyx_PyObject_Call(function, args, NULL);
27400  Py_DECREF(args);
27401  Py_DECREF(function);
27402 done:
27403  return result;
27404 }
27405 
27406 /* BytesEquals */
27407 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
27408 #if CYTHON_COMPILING_IN_PYPY
27409  return PyObject_RichCompareBool(s1, s2, equals);
27410 #else
27411  if (s1 == s2) {
27412  return (equals == Py_EQ);
27413  } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
27414  const char *ps1, *ps2;
27415  Py_ssize_t length = PyBytes_GET_SIZE(s1);
27416  if (length != PyBytes_GET_SIZE(s2))
27417  return (equals == Py_NE);
27418  ps1 = PyBytes_AS_STRING(s1);
27419  ps2 = PyBytes_AS_STRING(s2);
27420  if (ps1[0] != ps2[0]) {
27421  return (equals == Py_NE);
27422  } else if (length == 1) {
27423  return (equals == Py_EQ);
27424  } else {
27425  int result;
27426 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
27427  Py_hash_t hash1, hash2;
27428  hash1 = ((PyBytesObject*)s1)->ob_shash;
27429  hash2 = ((PyBytesObject*)s2)->ob_shash;
27430  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
27431  return (equals == Py_NE);
27432  }
27433 #endif
27434  result = memcmp(ps1, ps2, (size_t)length);
27435  return (equals == Py_EQ) ? (result == 0) : (result != 0);
27436  }
27437  } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
27438  return (equals == Py_NE);
27439  } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
27440  return (equals == Py_NE);
27441  } else {
27442  int result;
27443  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
27444  if (!py_result)
27445  return -1;
27446  result = __Pyx_PyObject_IsTrue(py_result);
27447  Py_DECREF(py_result);
27448  return result;
27449  }
27450 #endif
27451 }
27452 
27453 /* RaiseException */
27454 #if PY_MAJOR_VERSION < 3
27455 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
27456  CYTHON_UNUSED PyObject *cause) {
27457  __Pyx_PyThreadState_declare
27458  Py_XINCREF(type);
27459  if (!value || value == Py_None)
27460  value = NULL;
27461  else
27462  Py_INCREF(value);
27463  if (!tb || tb == Py_None)
27464  tb = NULL;
27465  else {
27466  Py_INCREF(tb);
27467  if (!PyTraceBack_Check(tb)) {
27468  PyErr_SetString(PyExc_TypeError,
27469  "raise: arg 3 must be a traceback or None");
27470  goto raise_error;
27471  }
27472  }
27473  if (PyType_Check(type)) {
27474 #if CYTHON_COMPILING_IN_PYPY
27475  if (!value) {
27476  Py_INCREF(Py_None);
27477  value = Py_None;
27478  }
27479 #endif
27480  PyErr_NormalizeException(&type, &value, &tb);
27481  } else {
27482  if (value) {
27483  PyErr_SetString(PyExc_TypeError,
27484  "instance exception may not have a separate value");
27485  goto raise_error;
27486  }
27487  value = type;
27488  type = (PyObject*) Py_TYPE(type);
27489  Py_INCREF(type);
27490  if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
27491  PyErr_SetString(PyExc_TypeError,
27492  "raise: exception class must be a subclass of BaseException");
27493  goto raise_error;
27494  }
27495  }
27496  __Pyx_PyThreadState_assign
27497  __Pyx_ErrRestore(type, value, tb);
27498  return;
27499 raise_error:
27500  Py_XDECREF(value);
27501  Py_XDECREF(type);
27502  Py_XDECREF(tb);
27503  return;
27504 }
27505 #else
27506 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
27507  PyObject* owned_instance = NULL;
27508  if (tb == Py_None) {
27509  tb = 0;
27510  } else if (tb && !PyTraceBack_Check(tb)) {
27511  PyErr_SetString(PyExc_TypeError,
27512  "raise: arg 3 must be a traceback or None");
27513  goto bad;
27514  }
27515  if (value == Py_None)
27516  value = 0;
27517  if (PyExceptionInstance_Check(type)) {
27518  if (value) {
27519  PyErr_SetString(PyExc_TypeError,
27520  "instance exception may not have a separate value");
27521  goto bad;
27522  }
27523  value = type;
27524  type = (PyObject*) Py_TYPE(value);
27525  } else if (PyExceptionClass_Check(type)) {
27526  PyObject *instance_class = NULL;
27527  if (value && PyExceptionInstance_Check(value)) {
27528  instance_class = (PyObject*) Py_TYPE(value);
27529  if (instance_class != type) {
27530  int is_subclass = PyObject_IsSubclass(instance_class, type);
27531  if (!is_subclass) {
27532  instance_class = NULL;
27533  } else if (unlikely(is_subclass == -1)) {
27534  goto bad;
27535  } else {
27536  type = instance_class;
27537  }
27538  }
27539  }
27540  if (!instance_class) {
27541  PyObject *args;
27542  if (!value)
27543  args = PyTuple_New(0);
27544  else if (PyTuple_Check(value)) {
27545  Py_INCREF(value);
27546  args = value;
27547  } else
27548  args = PyTuple_Pack(1, value);
27549  if (!args)
27550  goto bad;
27551  owned_instance = PyObject_Call(type, args, NULL);
27552  Py_DECREF(args);
27553  if (!owned_instance)
27554  goto bad;
27555  value = owned_instance;
27556  if (!PyExceptionInstance_Check(value)) {
27557  PyErr_Format(PyExc_TypeError,
27558  "calling %R should have returned an instance of "
27559  "BaseException, not %R",
27560  type, Py_TYPE(value));
27561  goto bad;
27562  }
27563  }
27564  } else {
27565  PyErr_SetString(PyExc_TypeError,
27566  "raise: exception class must be a subclass of BaseException");
27567  goto bad;
27568  }
27569  if (cause) {
27570  PyObject *fixed_cause;
27571  if (cause == Py_None) {
27572  fixed_cause = NULL;
27573  } else if (PyExceptionClass_Check(cause)) {
27574  fixed_cause = PyObject_CallObject(cause, NULL);
27575  if (fixed_cause == NULL)
27576  goto bad;
27577  } else if (PyExceptionInstance_Check(cause)) {
27578  fixed_cause = cause;
27579  Py_INCREF(fixed_cause);
27580  } else {
27581  PyErr_SetString(PyExc_TypeError,
27582  "exception causes must derive from "
27583  "BaseException");
27584  goto bad;
27585  }
27586  PyException_SetCause(value, fixed_cause);
27587  }
27588  PyErr_SetObject(type, value);
27589  if (tb) {
27590 #if CYTHON_FAST_THREAD_STATE
27591  PyThreadState *tstate = __Pyx_PyThreadState_Current;
27592  PyObject* tmp_tb = tstate->curexc_traceback;
27593  if (tb != tmp_tb) {
27594  Py_INCREF(tb);
27595  tstate->curexc_traceback = tb;
27596  Py_XDECREF(tmp_tb);
27597  }
27598 #else
27599  PyObject *tmp_type, *tmp_value, *tmp_tb;
27600  PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
27601  Py_INCREF(tb);
27602  PyErr_Restore(tmp_type, tmp_value, tb);
27603  Py_XDECREF(tmp_tb);
27604 #endif
27605  }
27606 bad:
27607  Py_XDECREF(owned_instance);
27608  return;
27609 }
27610 #endif
27611 
27612 /* SliceObject */
27613 static CYTHON_INLINE int __Pyx_PyObject_SetSlice(PyObject* obj, PyObject* value,
27614  Py_ssize_t cstart, Py_ssize_t cstop,
27615  PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice,
27616  int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) {
27617 #if CYTHON_USE_TYPE_SLOTS
27618  PyMappingMethods* mp;
27619 #if PY_MAJOR_VERSION < 3
27620  PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence;
27621  if (likely(ms && ms->sq_ass_slice)) {
27622  if (!has_cstart) {
27623  if (_py_start && (*_py_start != Py_None)) {
27624  cstart = __Pyx_PyIndex_AsSsize_t(*_py_start);
27625  if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
27626  } else
27627  cstart = 0;
27628  }
27629  if (!has_cstop) {
27630  if (_py_stop && (*_py_stop != Py_None)) {
27631  cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop);
27632  if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad;
27633  } else
27634  cstop = PY_SSIZE_T_MAX;
27635  }
27636  if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) {
27637  Py_ssize_t l = ms->sq_length(obj);
27638  if (likely(l >= 0)) {
27639  if (cstop < 0) {
27640  cstop += l;
27641  if (cstop < 0) cstop = 0;
27642  }
27643  if (cstart < 0) {
27644  cstart += l;
27645  if (cstart < 0) cstart = 0;
27646  }
27647  } else {
27648  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27649  goto bad;
27650  PyErr_Clear();
27651  }
27652  }
27653  return ms->sq_ass_slice(obj, cstart, cstop, value);
27654  }
27655 #endif
27656  mp = Py_TYPE(obj)->tp_as_mapping;
27657  if (likely(mp && mp->mp_ass_subscript))
27658 #endif
27659  {
27660  int result;
27661  PyObject *py_slice, *py_start, *py_stop;
27662  if (_py_slice) {
27663  py_slice = *_py_slice;
27664  } else {
27665  PyObject* owned_start = NULL;
27666  PyObject* owned_stop = NULL;
27667  if (_py_start) {
27668  py_start = *_py_start;
27669  } else {
27670  if (has_cstart) {
27671  owned_start = py_start = PyInt_FromSsize_t(cstart);
27672  if (unlikely(!py_start)) goto bad;
27673  } else
27674  py_start = Py_None;
27675  }
27676  if (_py_stop) {
27677  py_stop = *_py_stop;
27678  } else {
27679  if (has_cstop) {
27680  owned_stop = py_stop = PyInt_FromSsize_t(cstop);
27681  if (unlikely(!py_stop)) {
27682  Py_XDECREF(owned_start);
27683  goto bad;
27684  }
27685  } else
27686  py_stop = Py_None;
27687  }
27688  py_slice = PySlice_New(py_start, py_stop, Py_None);
27689  Py_XDECREF(owned_start);
27690  Py_XDECREF(owned_stop);
27691  if (unlikely(!py_slice)) goto bad;
27692  }
27693 #if CYTHON_USE_TYPE_SLOTS
27694  result = mp->mp_ass_subscript(obj, py_slice, value);
27695 #else
27696  result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice);
27697 #endif
27698  if (!_py_slice) {
27699  Py_DECREF(py_slice);
27700  }
27701  return result;
27702  }
27703  PyErr_Format(PyExc_TypeError,
27704  "'%.200s' object does not support slice %.10s",
27705  Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion");
27706 bad:
27707  return -1;
27708 }
27709 
27710 /* PyIntCompare */
27711 static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) {
27712  if (op1 == op2) {
27713  Py_RETURN_TRUE;
27714  }
27715  #if PY_MAJOR_VERSION < 3
27716  if (likely(PyInt_CheckExact(op1))) {
27717  const long b = intval;
27718  long a = PyInt_AS_LONG(op1);
27719  if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
27720  }
27721  #endif
27722  #if CYTHON_USE_PYLONG_INTERNALS
27723  if (likely(PyLong_CheckExact(op1))) {
27724  int unequal;
27725  unsigned long uintval;
27726  Py_ssize_t size = Py_SIZE(op1);
27727  const digit* digits = ((PyLongObject*)op1)->ob_digit;
27728  if (intval == 0) {
27729  if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
27730  } else if (intval < 0) {
27731  if (size >= 0)
27732  Py_RETURN_FALSE;
27733  intval = -intval;
27734  size = -size;
27735  } else {
27736  if (size <= 0)
27737  Py_RETURN_FALSE;
27738  }
27739  uintval = (unsigned long) intval;
27740 #if PyLong_SHIFT * 4 < SIZEOF_LONG*8
27741  if (uintval >> (PyLong_SHIFT * 4)) {
27742  unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
27743  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
27744  } else
27745 #endif
27746 #if PyLong_SHIFT * 3 < SIZEOF_LONG*8
27747  if (uintval >> (PyLong_SHIFT * 3)) {
27748  unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
27749  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
27750  } else
27751 #endif
27752 #if PyLong_SHIFT * 2 < SIZEOF_LONG*8
27753  if (uintval >> (PyLong_SHIFT * 2)) {
27754  unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
27755  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
27756  } else
27757 #endif
27758 #if PyLong_SHIFT * 1 < SIZEOF_LONG*8
27759  if (uintval >> (PyLong_SHIFT * 1)) {
27760  unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK))
27761  | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK));
27762  } else
27763 #endif
27764  unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK));
27765  if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE;
27766  }
27767  #endif
27768  if (PyFloat_CheckExact(op1)) {
27769  const long b = intval;
27770  double a = PyFloat_AS_DOUBLE(op1);
27771  if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE;
27772  }
27773  return (
27774  PyObject_RichCompare(op1, op2, Py_EQ));
27775 }
27776 
27777 /* MatrixMultiply */
27778 #if PY_VERSION_HEX < 0x03050000
27779 static PyObject* __Pyx_PyObject_CallMatrixMethod(PyObject* method, PyObject* arg) {
27780  PyObject *result = NULL;
27781 #if CYTHON_UNPACK_METHODS
27782  if (likely(PyMethod_Check(method))) {
27783  PyObject *self = PyMethod_GET_SELF(method);
27784  if (likely(self)) {
27785  PyObject *args;
27786  PyObject *function = PyMethod_GET_FUNCTION(method);
27787  #if CYTHON_FAST_PYCALL
27788  if (PyFunction_Check(function)) {
27789  PyObject *args[2] = {self, arg};
27790  result = __Pyx_PyFunction_FastCall(function, args, 2);
27791  goto done;
27792  }
27793  #endif
27794  #if CYTHON_FAST_PYCCALL
27795  if (__Pyx_PyFastCFunction_Check(function)) {
27796  PyObject *args[2] = {self, arg};
27797  result = __Pyx_PyCFunction_FastCall(function, args, 2);
27798  goto done;
27799  }
27800  #endif
27801  args = PyTuple_New(2);
27802  if (unlikely(!args)) goto done;
27803  Py_INCREF(self);
27804  PyTuple_SET_ITEM(args, 0, self);
27805  Py_INCREF(arg);
27806  PyTuple_SET_ITEM(args, 1, arg);
27807  Py_INCREF(function);
27808  Py_DECREF(method); method = NULL;
27809  result = __Pyx_PyObject_Call(function, args, NULL);
27810  Py_DECREF(args);
27811  Py_DECREF(function);
27812  return result;
27813  }
27814  }
27815 #endif
27816  result = __Pyx_PyObject_CallOneArg(method, arg);
27817 done:
27818  Py_DECREF(method);
27819  return result;
27820 }
27821 #define __Pyx_TryMatrixMethod(x, y, py_method_name) {\
27822  PyObject *func = __Pyx_PyObject_GetAttrStr(x, py_method_name);\
27823  if (func) {\
27824  PyObject *result = __Pyx_PyObject_CallMatrixMethod(func, y);\
27825  if (result != Py_NotImplemented)\
27826  return result;\
27827  Py_DECREF(result);\
27828  } else {\
27829  if (!PyErr_ExceptionMatches(PyExc_AttributeError))\
27830  return NULL;\
27831  PyErr_Clear();\
27832  }\
27833 }
27834 static PyObject* __Pyx__PyNumber_MatrixMultiply(PyObject* x, PyObject* y, const char* op_name) {
27835  int right_is_subtype = PyObject_IsSubclass((PyObject*)Py_TYPE(y), (PyObject*)Py_TYPE(x));
27836  if (unlikely(right_is_subtype == -1))
27837  return NULL;
27838  if (right_is_subtype) {
27839  __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
27840  }
27841  __Pyx_TryMatrixMethod(x, y, __pyx_n_s_matmul)
27842  if (!right_is_subtype) {
27843  __Pyx_TryMatrixMethod(y, x, __pyx_n_s_rmatmul)
27844  }
27845  PyErr_Format(PyExc_TypeError,
27846  "unsupported operand type(s) for %.2s: '%.100s' and '%.100s'",
27847  op_name,
27848  Py_TYPE(x)->tp_name,
27849  Py_TYPE(y)->tp_name);
27850  return NULL;
27851 }
27852 static PyObject* __Pyx_PyNumber_InPlaceMatrixMultiply(PyObject* x, PyObject* y) {
27853  __Pyx_TryMatrixMethod(x, y, __pyx_n_s_imatmul)
27854  return __Pyx__PyNumber_MatrixMultiply(x, y, "@=");
27855 }
27856 #undef __Pyx_TryMatrixMethod
27857 #endif
27858 
27859 /* ObjectGetItem */
27860 #if CYTHON_USE_TYPE_SLOTS
27861 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
27862  PyObject *runerr = NULL;
27863  Py_ssize_t key_value;
27864  PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
27865  if (unlikely(!(m && m->sq_item))) {
27866  PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
27867  return NULL;
27868  }
27869  key_value = __Pyx_PyIndex_AsSsize_t(index);
27870  if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
27871  return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
27872  }
27873  if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
27874  PyErr_Clear();
27875  PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
27876  }
27877  return NULL;
27878 }
27879 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
27880  PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
27881  if (likely(m && m->mp_subscript)) {
27882  return m->mp_subscript(obj, key);
27883  }
27884  return __Pyx_PyObject_GetIndex(obj, key);
27885 }
27886 #endif
27887 
27888 /* SetItemInt */
27889 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
27890  int r;
27891  if (!j) return -1;
27892  r = PyObject_SetItem(o, j, v);
27893  Py_DECREF(j);
27894  return r;
27895 }
27896 static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list,
27897  CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) {
27898 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
27899  if (is_list || PyList_CheckExact(o)) {
27900  Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
27901  if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
27902  PyObject* old = PyList_GET_ITEM(o, n);
27903  Py_INCREF(v);
27904  PyList_SET_ITEM(o, n, v);
27905  Py_DECREF(old);
27906  return 1;
27907  }
27908  } else {
27909  PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
27910  if (likely(m && m->sq_ass_item)) {
27911  if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
27912  Py_ssize_t l = m->sq_length(o);
27913  if (likely(l >= 0)) {
27914  i += l;
27915  } else {
27916  if (!PyErr_ExceptionMatches(PyExc_OverflowError))
27917  return -1;
27918  PyErr_Clear();
27919  }
27920  }
27921  return m->sq_ass_item(o, i, v);
27922  }
27923  }
27924 #else
27925 #if CYTHON_COMPILING_IN_PYPY
27926  if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
27927 #else
27928  if (is_list || PySequence_Check(o))
27929 #endif
27930  {
27931  return PySequence_SetItem(o, i, v);
27932  }
27933 #endif
27934  return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
27935 }
27936 
27937 /* MemviewSliceInit */
27938 static int
27939 __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
27940  int ndim,
27941  __Pyx_memviewslice *memviewslice,
27942  int memview_is_new_reference)
27943 {
27944  __Pyx_RefNannyDeclarations
27945  int i, retval=-1;
27946  Py_buffer *buf = &memview->view;
27947  __Pyx_RefNannySetupContext("init_memviewslice", 0);
27948  if (unlikely(memviewslice->memview || memviewslice->data)) {
27949  PyErr_SetString(PyExc_ValueError,
27950  "memviewslice is already initialized!");
27951  goto fail;
27952  }
27953  if (buf->strides) {
27954  for (i = 0; i < ndim; i++) {
27955  memviewslice->strides[i] = buf->strides[i];
27956  }
27957  } else {
27958  Py_ssize_t stride = buf->itemsize;
27959  for (i = ndim - 1; i >= 0; i--) {
27960  memviewslice->strides[i] = stride;
27961  stride *= buf->shape[i];
27962  }
27963  }
27964  for (i = 0; i < ndim; i++) {
27965  memviewslice->shape[i] = buf->shape[i];
27966  if (buf->suboffsets) {
27967  memviewslice->suboffsets[i] = buf->suboffsets[i];
27968  } else {
27969  memviewslice->suboffsets[i] = -1;
27970  }
27971  }
27972  memviewslice->memview = memview;
27973  memviewslice->data = (char *)buf->buf;
27974  if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
27975  Py_INCREF(memview);
27976  }
27977  retval = 0;
27978  goto no_fail;
27979 fail:
27980  memviewslice->memview = 0;
27981  memviewslice->data = 0;
27982  retval = -1;
27983 no_fail:
27984  __Pyx_RefNannyFinishContext();
27985  return retval;
27986 }
27987 #ifndef Py_NO_RETURN
27988 #define Py_NO_RETURN
27989 #endif
27990 static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
27991  va_list vargs;
27992  char msg[200];
27993 #if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
27994  va_start(vargs, fmt);
27995 #else
27996  va_start(vargs);
27997 #endif
27998  vsnprintf(msg, 200, fmt, vargs);
27999  va_end(vargs);
28000  Py_FatalError(msg);
28001 }
28002 static CYTHON_INLINE int
28003 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
28004  PyThread_type_lock lock)
28005 {
28006  int result;
28007  PyThread_acquire_lock(lock, 1);
28008  result = (*acquisition_count)++;
28009  PyThread_release_lock(lock);
28010  return result;
28011 }
28012 static CYTHON_INLINE int
28013 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
28014  PyThread_type_lock lock)
28015 {
28016  int result;
28017  PyThread_acquire_lock(lock, 1);
28018  result = (*acquisition_count)--;
28019  PyThread_release_lock(lock);
28020  return result;
28021 }
28022 static CYTHON_INLINE void
28023 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
28024 {
28025  int first_time;
28026  struct __pyx_memoryview_obj *memview = memslice->memview;
28027  if (unlikely(!memview || (PyObject *) memview == Py_None))
28028  return;
28029  if (unlikely(__pyx_get_slice_count(memview) < 0))
28030  __pyx_fatalerror("Acquisition count is %d (line %d)",
28031  __pyx_get_slice_count(memview), lineno);
28032  first_time = __pyx_add_acquisition_count(memview) == 0;
28033  if (unlikely(first_time)) {
28034  if (have_gil) {
28035  Py_INCREF((PyObject *) memview);
28036  } else {
28037  PyGILState_STATE _gilstate = PyGILState_Ensure();
28038  Py_INCREF((PyObject *) memview);
28039  PyGILState_Release(_gilstate);
28040  }
28041  }
28042 }
28043 static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
28044  int have_gil, int lineno) {
28045  int last_time;
28046  struct __pyx_memoryview_obj *memview = memslice->memview;
28047  if (unlikely(!memview || (PyObject *) memview == Py_None)) {
28048  memslice->memview = NULL;
28049  return;
28050  }
28051  if (unlikely(__pyx_get_slice_count(memview) <= 0))
28052  __pyx_fatalerror("Acquisition count is %d (line %d)",
28053  __pyx_get_slice_count(memview), lineno);
28054  last_time = __pyx_sub_acquisition_count(memview) == 1;
28055  memslice->data = NULL;
28056  if (unlikely(last_time)) {
28057  if (have_gil) {
28058  Py_CLEAR(memslice->memview);
28059  } else {
28060  PyGILState_STATE _gilstate = PyGILState_Ensure();
28061  Py_CLEAR(memslice->memview);
28062  PyGILState_Release(_gilstate);
28063  }
28064  } else {
28065  memslice->memview = NULL;
28066  }
28067 }
28068 
28069 /* None */
28070 static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
28071  PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
28072 }
28073 
28074 /* ArgTypeTest */
28075 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
28076 {
28077  if (unlikely(!type)) {
28078  PyErr_SetString(PyExc_SystemError, "Missing type object");
28079  return 0;
28080  }
28081  else if (exact) {
28082  #if PY_MAJOR_VERSION == 2
28083  if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
28084  #endif
28085  }
28086  else {
28087  if (likely(__Pyx_TypeCheck(obj, type))) return 1;
28088  }
28089  PyErr_Format(PyExc_TypeError,
28090  "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
28091  name, type->tp_name, Py_TYPE(obj)->tp_name);
28092  return 0;
28093 }
28094 
28095 /* UnicodeEquals */
28096 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
28097 #if CYTHON_COMPILING_IN_PYPY
28098  return PyObject_RichCompareBool(s1, s2, equals);
28099 #else
28100 #if PY_MAJOR_VERSION < 3
28101  PyObject* owned_ref = NULL;
28102 #endif
28103  int s1_is_unicode, s2_is_unicode;
28104  if (s1 == s2) {
28105  goto return_eq;
28106  }
28107  s1_is_unicode = PyUnicode_CheckExact(s1);
28108  s2_is_unicode = PyUnicode_CheckExact(s2);
28109 #if PY_MAJOR_VERSION < 3
28110  if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
28111  owned_ref = PyUnicode_FromObject(s2);
28112  if (unlikely(!owned_ref))
28113  return -1;
28114  s2 = owned_ref;
28115  s2_is_unicode = 1;
28116  } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
28117  owned_ref = PyUnicode_FromObject(s1);
28118  if (unlikely(!owned_ref))
28119  return -1;
28120  s1 = owned_ref;
28121  s1_is_unicode = 1;
28122  } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
28123  return __Pyx_PyBytes_Equals(s1, s2, equals);
28124  }
28125 #endif
28126  if (s1_is_unicode & s2_is_unicode) {
28127  Py_ssize_t length;
28128  int kind;
28129  void *data1, *data2;
28130  if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
28131  return -1;
28132  length = __Pyx_PyUnicode_GET_LENGTH(s1);
28133  if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
28134  goto return_ne;
28135  }
28136 #if CYTHON_USE_UNICODE_INTERNALS
28137  {
28138  Py_hash_t hash1, hash2;
28139  #if CYTHON_PEP393_ENABLED
28140  hash1 = ((PyASCIIObject*)s1)->hash;
28141  hash2 = ((PyASCIIObject*)s2)->hash;
28142  #else
28143  hash1 = ((PyUnicodeObject*)s1)->hash;
28144  hash2 = ((PyUnicodeObject*)s2)->hash;
28145  #endif
28146  if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
28147  goto return_ne;
28148  }
28149  }
28150 #endif
28151  kind = __Pyx_PyUnicode_KIND(s1);
28152  if (kind != __Pyx_PyUnicode_KIND(s2)) {
28153  goto return_ne;
28154  }
28155  data1 = __Pyx_PyUnicode_DATA(s1);
28156  data2 = __Pyx_PyUnicode_DATA(s2);
28157  if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
28158  goto return_ne;
28159  } else if (length == 1) {
28160  goto return_eq;
28161  } else {
28162  int result = memcmp(data1, data2, (size_t)(length * kind));
28163  #if PY_MAJOR_VERSION < 3
28164  Py_XDECREF(owned_ref);
28165  #endif
28166  return (equals == Py_EQ) ? (result == 0) : (result != 0);
28167  }
28168  } else if ((s1 == Py_None) & s2_is_unicode) {
28169  goto return_ne;
28170  } else if ((s2 == Py_None) & s1_is_unicode) {
28171  goto return_ne;
28172  } else {
28173  int result;
28174  PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
28175  #if PY_MAJOR_VERSION < 3
28176  Py_XDECREF(owned_ref);
28177  #endif
28178  if (!py_result)
28179  return -1;
28180  result = __Pyx_PyObject_IsTrue(py_result);
28181  Py_DECREF(py_result);
28182  return result;
28183  }
28184 return_eq:
28185  #if PY_MAJOR_VERSION < 3
28186  Py_XDECREF(owned_ref);
28187  #endif
28188  return (equals == Py_EQ);
28189 return_ne:
28190  #if PY_MAJOR_VERSION < 3
28191  Py_XDECREF(owned_ref);
28192  #endif
28193  return (equals == Py_NE);
28194 #endif
28195 }
28196 
28197 /* WriteUnraisableException */
28198 static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
28199  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
28200  int full_traceback, CYTHON_UNUSED int nogil) {
28201  PyObject *old_exc, *old_val, *old_tb;
28202  PyObject *ctx;
28203  __Pyx_PyThreadState_declare
28204 #ifdef WITH_THREAD
28205  PyGILState_STATE state;
28206  if (nogil)
28207  state = PyGILState_Ensure();
28208  else state = (PyGILState_STATE)0;
28209 #endif
28210  __Pyx_PyThreadState_assign
28211  __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
28212  if (full_traceback) {
28213  Py_XINCREF(old_exc);
28214  Py_XINCREF(old_val);
28215  Py_XINCREF(old_tb);
28216  __Pyx_ErrRestore(old_exc, old_val, old_tb);
28217  PyErr_PrintEx(1);
28218  }
28219  #if PY_MAJOR_VERSION < 3
28220  ctx = PyString_FromString(name);
28221  #else
28222  ctx = PyUnicode_FromString(name);
28223  #endif
28224  __Pyx_ErrRestore(old_exc, old_val, old_tb);
28225  if (!ctx) {
28226  PyErr_WriteUnraisable(Py_None);
28227  } else {
28228  PyErr_WriteUnraisable(ctx);
28229  Py_DECREF(ctx);
28230  }
28231 #ifdef WITH_THREAD
28232  if (nogil)
28233  PyGILState_Release(state);
28234 #endif
28235 }
28236 
28237 /* GetAttr */
28238 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
28239 #if CYTHON_USE_TYPE_SLOTS
28240 #if PY_MAJOR_VERSION >= 3
28241  if (likely(PyUnicode_Check(n)))
28242 #else
28243  if (likely(PyString_Check(n)))
28244 #endif
28245  return __Pyx_PyObject_GetAttrStr(o, n);
28246 #endif
28247  return PyObject_GetAttr(o, n);
28248 }
28249 
28250 /* decode_c_string */
28251 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
28252  const char* cstring, Py_ssize_t start, Py_ssize_t stop,
28253  const char* encoding, const char* errors,
28254  PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
28255  Py_ssize_t length;
28256  if (unlikely((start < 0) | (stop < 0))) {
28257  size_t slen = strlen(cstring);
28258  if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
28259  PyErr_SetString(PyExc_OverflowError,
28260  "c-string too long to convert to Python");
28261  return NULL;
28262  }
28263  length = (Py_ssize_t) slen;
28264  if (start < 0) {
28265  start += length;
28266  if (start < 0)
28267  start = 0;
28268  }
28269  if (stop < 0)
28270  stop += length;
28271  }
28272  if (unlikely(stop <= start))
28273  return __Pyx_NewRef(__pyx_empty_unicode);
28274  length = stop - start;
28275  cstring += start;
28276  if (decode_func) {
28277  return decode_func(cstring, length, errors);
28278  } else {
28279  return PyUnicode_Decode(cstring, length, encoding, errors);
28280  }
28281 }
28282 
28283 /* PyErrExceptionMatches */
28284 #if CYTHON_FAST_THREAD_STATE
28285 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28286  Py_ssize_t i, n;
28287  n = PyTuple_GET_SIZE(tuple);
28288 #if PY_MAJOR_VERSION >= 3
28289  for (i=0; i<n; i++) {
28290  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
28291  }
28292 #endif
28293  for (i=0; i<n; i++) {
28294  if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
28295  }
28296  return 0;
28297 }
28298 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
28299  PyObject *exc_type = tstate->curexc_type;
28300  if (exc_type == err) return 1;
28301  if (unlikely(!exc_type)) return 0;
28302  if (unlikely(PyTuple_Check(err)))
28303  return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
28304  return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
28305 }
28306 #endif
28307 
28308 /* GetAttr3 */
28309 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
28310  __Pyx_PyThreadState_declare
28311  __Pyx_PyThreadState_assign
28312  if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
28313  return NULL;
28314  __Pyx_PyErr_Clear();
28315  Py_INCREF(d);
28316  return d;
28317 }
28318 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
28319  PyObject *r = __Pyx_GetAttr(o, n);
28320  return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
28321 }
28322 
28323 /* RaiseNoneIterError */
28324 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
28325  PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
28326 }
28327 
28328 /* ExtTypeTest */
28329 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
28330  if (unlikely(!type)) {
28331  PyErr_SetString(PyExc_SystemError, "Missing type object");
28332  return 0;
28333  }
28334  if (likely(__Pyx_TypeCheck(obj, type)))
28335  return 1;
28336  PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
28337  Py_TYPE(obj)->tp_name, type->tp_name);
28338  return 0;
28339 }
28340 
28341 /* GetTopmostException */
28342 #if CYTHON_USE_EXC_INFO_STACK
28343 static _PyErr_StackItem *
28344 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
28345 {
28346  _PyErr_StackItem *exc_info = tstate->exc_info;
28347  while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
28348  exc_info->previous_item != NULL)
28349  {
28350  exc_info = exc_info->previous_item;
28351  }
28352  return exc_info;
28353 }
28354 #endif
28355 
28356 /* SaveResetException */
28357 #if CYTHON_FAST_THREAD_STATE
28358 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
28359  #if CYTHON_USE_EXC_INFO_STACK
28360  _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
28361  *type = exc_info->exc_type;
28362  *value = exc_info->exc_value;
28363  *tb = exc_info->exc_traceback;
28364  #else
28365  *type = tstate->exc_type;
28366  *value = tstate->exc_value;
28367  *tb = tstate->exc_traceback;
28368  #endif
28369  Py_XINCREF(*type);
28370  Py_XINCREF(*value);
28371  Py_XINCREF(*tb);
28372 }
28373 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
28374  PyObject *tmp_type, *tmp_value, *tmp_tb;
28375  #if CYTHON_USE_EXC_INFO_STACK
28376  _PyErr_StackItem *exc_info = tstate->exc_info;
28377  tmp_type = exc_info->exc_type;
28378  tmp_value = exc_info->exc_value;
28379  tmp_tb = exc_info->exc_traceback;
28380  exc_info->exc_type = type;
28381  exc_info->exc_value = value;
28382  exc_info->exc_traceback = tb;
28383  #else
28384  tmp_type = tstate->exc_type;
28385  tmp_value = tstate->exc_value;
28386  tmp_tb = tstate->exc_traceback;
28387  tstate->exc_type = type;
28388  tstate->exc_value = value;
28389  tstate->exc_traceback = tb;
28390  #endif
28391  Py_XDECREF(tmp_type);
28392  Py_XDECREF(tmp_value);
28393  Py_XDECREF(tmp_tb);
28394 }
28395 #endif
28396 
28397 /* GetException */
28398 #if CYTHON_FAST_THREAD_STATE
28399 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
28400 #else
28401 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
28402 #endif
28403 {
28404  PyObject *local_type, *local_value, *local_tb;
28405 #if CYTHON_FAST_THREAD_STATE
28406  PyObject *tmp_type, *tmp_value, *tmp_tb;
28407  local_type = tstate->curexc_type;
28408  local_value = tstate->curexc_value;
28409  local_tb = tstate->curexc_traceback;
28410  tstate->curexc_type = 0;
28411  tstate->curexc_value = 0;
28412  tstate->curexc_traceback = 0;
28413 #else
28414  PyErr_Fetch(&local_type, &local_value, &local_tb);
28415 #endif
28416  PyErr_NormalizeException(&local_type, &local_value, &local_tb);
28417 #if CYTHON_FAST_THREAD_STATE
28418  if (unlikely(tstate->curexc_type))
28419 #else
28420  if (unlikely(PyErr_Occurred()))
28421 #endif
28422  goto bad;
28423  #if PY_MAJOR_VERSION >= 3
28424  if (local_tb) {
28425  if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
28426  goto bad;
28427  }
28428  #endif
28429  Py_XINCREF(local_tb);
28430  Py_XINCREF(local_type);
28431  Py_XINCREF(local_value);
28432  *type = local_type;
28433  *value = local_value;
28434  *tb = local_tb;
28435 #if CYTHON_FAST_THREAD_STATE
28436  #if CYTHON_USE_EXC_INFO_STACK
28437  {
28438  _PyErr_StackItem *exc_info = tstate->exc_info;
28439  tmp_type = exc_info->exc_type;
28440  tmp_value = exc_info->exc_value;
28441  tmp_tb = exc_info->exc_traceback;
28442  exc_info->exc_type = local_type;
28443  exc_info->exc_value = local_value;
28444  exc_info->exc_traceback = local_tb;
28445  }
28446  #else
28447  tmp_type = tstate->exc_type;
28448  tmp_value = tstate->exc_value;
28449  tmp_tb = tstate->exc_traceback;
28450  tstate->exc_type = local_type;
28451  tstate->exc_value = local_value;
28452  tstate->exc_traceback = local_tb;
28453  #endif
28454  Py_XDECREF(tmp_type);
28455  Py_XDECREF(tmp_value);
28456  Py_XDECREF(tmp_tb);
28457 #else
28458  PyErr_SetExcInfo(local_type, local_value, local_tb);
28459 #endif
28460  return 0;
28461 bad:
28462  *type = 0;
28463  *value = 0;
28464  *tb = 0;
28465  Py_XDECREF(local_type);
28466  Py_XDECREF(local_value);
28467  Py_XDECREF(local_tb);
28468  return -1;
28469 }
28470 
28471 /* SwapException */
28472 #if CYTHON_FAST_THREAD_STATE
28473 static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
28474  PyObject *tmp_type, *tmp_value, *tmp_tb;
28475  #if CYTHON_USE_EXC_INFO_STACK
28476  _PyErr_StackItem *exc_info = tstate->exc_info;
28477  tmp_type = exc_info->exc_type;
28478  tmp_value = exc_info->exc_value;
28479  tmp_tb = exc_info->exc_traceback;
28480  exc_info->exc_type = *type;
28481  exc_info->exc_value = *value;
28482  exc_info->exc_traceback = *tb;
28483  #else
28484  tmp_type = tstate->exc_type;
28485  tmp_value = tstate->exc_value;
28486  tmp_tb = tstate->exc_traceback;
28487  tstate->exc_type = *type;
28488  tstate->exc_value = *value;
28489  tstate->exc_traceback = *tb;
28490  #endif
28491  *type = tmp_type;
28492  *value = tmp_value;
28493  *tb = tmp_tb;
28494 }
28495 #else
28496 static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
28497  PyObject *tmp_type, *tmp_value, *tmp_tb;
28498  PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
28499  PyErr_SetExcInfo(*type, *value, *tb);
28500  *type = tmp_type;
28501  *value = tmp_value;
28502  *tb = tmp_tb;
28503 }
28504 #endif
28505 
28506 /* Import */
28507 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
28508  PyObject *empty_list = 0;
28509  PyObject *module = 0;
28510  PyObject *global_dict = 0;
28511  PyObject *empty_dict = 0;
28512  PyObject *list;
28513  #if PY_MAJOR_VERSION < 3
28514  PyObject *py_import;
28515  py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
28516  if (!py_import)
28517  goto bad;
28518  #endif
28519  if (from_list)
28520  list = from_list;
28521  else {
28522  empty_list = PyList_New(0);
28523  if (!empty_list)
28524  goto bad;
28525  list = empty_list;
28526  }
28527  global_dict = PyModule_GetDict(__pyx_m);
28528  if (!global_dict)
28529  goto bad;
28530  empty_dict = PyDict_New();
28531  if (!empty_dict)
28532  goto bad;
28533  {
28534  #if PY_MAJOR_VERSION >= 3
28535  if (level == -1) {
28536  if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
28537  module = PyImport_ImportModuleLevelObject(
28538  name, global_dict, empty_dict, list, 1);
28539  if (!module) {
28540  if (!PyErr_ExceptionMatches(PyExc_ImportError))
28541  goto bad;
28542  PyErr_Clear();
28543  }
28544  }
28545  level = 0;
28546  }
28547  #endif
28548  if (!module) {
28549  #if PY_MAJOR_VERSION < 3
28550  PyObject *py_level = PyInt_FromLong(level);
28551  if (!py_level)
28552  goto bad;
28553  module = PyObject_CallFunctionObjArgs(py_import,
28554  name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
28555  Py_DECREF(py_level);
28556  #else
28557  module = PyImport_ImportModuleLevelObject(
28558  name, global_dict, empty_dict, list, level);
28559  #endif
28560  }
28561  }
28562 bad:
28563  #if PY_MAJOR_VERSION < 3
28564  Py_XDECREF(py_import);
28565  #endif
28566  Py_XDECREF(empty_list);
28567  Py_XDECREF(empty_dict);
28568  return module;
28569 }
28570 
28571 /* FastTypeChecks */
28572 #if CYTHON_COMPILING_IN_CPYTHON
28573 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
28574  while (a) {
28575  a = a->tp_base;
28576  if (a == b)
28577  return 1;
28578  }
28579  return b == &PyBaseObject_Type;
28580 }
28581 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
28582  PyObject *mro;
28583  if (a == b) return 1;
28584  mro = a->tp_mro;
28585  if (likely(mro)) {
28586  Py_ssize_t i, n;
28587  n = PyTuple_GET_SIZE(mro);
28588  for (i = 0; i < n; i++) {
28589  if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
28590  return 1;
28591  }
28592  return 0;
28593  }
28594  return __Pyx_InBases(a, b);
28595 }
28596 #if PY_MAJOR_VERSION == 2
28597 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
28598  PyObject *exception, *value, *tb;
28599  int res;
28600  __Pyx_PyThreadState_declare
28601  __Pyx_PyThreadState_assign
28602  __Pyx_ErrFetch(&exception, &value, &tb);
28603  res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
28604  if (unlikely(res == -1)) {
28605  PyErr_WriteUnraisable(err);
28606  res = 0;
28607  }
28608  if (!res) {
28609  res = PyObject_IsSubclass(err, exc_type2);
28610  if (unlikely(res == -1)) {
28611  PyErr_WriteUnraisable(err);
28612  res = 0;
28613  }
28614  }
28615  __Pyx_ErrRestore(exception, value, tb);
28616  return res;
28617 }
28618 #else
28619 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
28620  int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
28621  if (!res) {
28622  res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
28623  }
28624  return res;
28625 }
28626 #endif
28627 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
28628  Py_ssize_t i, n;
28629  assert(PyExceptionClass_Check(exc_type));
28630  n = PyTuple_GET_SIZE(tuple);
28631 #if PY_MAJOR_VERSION >= 3
28632  for (i=0; i<n; i++) {
28633  if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
28634  }
28635 #endif
28636  for (i=0; i<n; i++) {
28637  PyObject *t = PyTuple_GET_ITEM(tuple, i);
28638  #if PY_MAJOR_VERSION < 3
28639  if (likely(exc_type == t)) return 1;
28640  #endif
28641  if (likely(PyExceptionClass_Check(t))) {
28642  if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
28643  } else {
28644  }
28645  }
28646  return 0;
28647 }
28648 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
28649  if (likely(err == exc_type)) return 1;
28650  if (likely(PyExceptionClass_Check(err))) {
28651  if (likely(PyExceptionClass_Check(exc_type))) {
28652  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
28653  } else if (likely(PyTuple_Check(exc_type))) {
28654  return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
28655  } else {
28656  }
28657  }
28658  return PyErr_GivenExceptionMatches(err, exc_type);
28659 }
28660 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
28661  assert(PyExceptionClass_Check(exc_type1));
28662  assert(PyExceptionClass_Check(exc_type2));
28663  if (likely(err == exc_type1 || err == exc_type2)) return 1;
28664  if (likely(PyExceptionClass_Check(err))) {
28665  return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
28666  }
28667  return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
28668 }
28669 #endif
28670 
28671 /* PyIntBinop */
28672 #if !CYTHON_COMPILING_IN_PYPY
28673 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
28674  (void)inplace;
28675  (void)zerodivision_check;
28676  #if PY_MAJOR_VERSION < 3
28677  if (likely(PyInt_CheckExact(op1))) {
28678  const long b = intval;
28679  long x;
28680  long a = PyInt_AS_LONG(op1);
28681  x = (long)((unsigned long)a + b);
28682  if (likely((x^a) >= 0 || (x^b) >= 0))
28683  return PyInt_FromLong(x);
28684  return PyLong_Type.tp_as_number->nb_add(op1, op2);
28685  }
28686  #endif
28687  #if CYTHON_USE_PYLONG_INTERNALS
28688  if (likely(PyLong_CheckExact(op1))) {
28689  const long b = intval;
28690  long a, x;
28691 #ifdef HAVE_LONG_LONG
28692  const PY_LONG_LONG llb = intval;
28693  PY_LONG_LONG lla, llx;
28694 #endif
28695  const digit* digits = ((PyLongObject*)op1)->ob_digit;
28696  const Py_ssize_t size = Py_SIZE(op1);
28697  if (likely(__Pyx_sst_abs(size) <= 1)) {
28698  a = likely(size) ? digits[0] : 0;
28699  if (size == -1) a = -a;
28700  } else {
28701  switch (size) {
28702  case -2:
28703  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28704  a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28705  break;
28706 #ifdef HAVE_LONG_LONG
28707  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
28708  lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28709  goto long_long;
28710 #endif
28711  }
28712  CYTHON_FALLTHROUGH;
28713  case 2:
28714  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
28715  a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28716  break;
28717 #ifdef HAVE_LONG_LONG
28718  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
28719  lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28720  goto long_long;
28721 #endif
28722  }
28723  CYTHON_FALLTHROUGH;
28724  case -3:
28725  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28726  a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28727  break;
28728 #ifdef HAVE_LONG_LONG
28729  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
28730  lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28731  goto long_long;
28732 #endif
28733  }
28734  CYTHON_FALLTHROUGH;
28735  case 3:
28736  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
28737  a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28738  break;
28739 #ifdef HAVE_LONG_LONG
28740  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
28741  lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28742  goto long_long;
28743 #endif
28744  }
28745  CYTHON_FALLTHROUGH;
28746  case -4:
28747  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28748  a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28749  break;
28750 #ifdef HAVE_LONG_LONG
28751  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
28752  lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28753  goto long_long;
28754 #endif
28755  }
28756  CYTHON_FALLTHROUGH;
28757  case 4:
28758  if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
28759  a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
28760  break;
28761 #ifdef HAVE_LONG_LONG
28762  } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
28763  lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
28764  goto long_long;
28765 #endif
28766  }
28767  CYTHON_FALLTHROUGH;
28768  default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
28769  }
28770  }
28771  x = a + b;
28772  return PyLong_FromLong(x);
28773 #ifdef HAVE_LONG_LONG
28774  long_long:
28775  llx = lla + llb;
28776  return PyLong_FromLongLong(llx);
28777 #endif
28778 
28779 
28780  }
28781  #endif
28782  if (PyFloat_CheckExact(op1)) {
28783  const long b = intval;
28784  double a = PyFloat_AS_DOUBLE(op1);
28785  double result;
28786  PyFPE_START_PROTECT("add", return NULL)
28787  result = ((double)a) + (double)b;
28788  PyFPE_END_PROTECT(result)
28789  return PyFloat_FromDouble(result);
28790  }
28791  return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
28792 }
28793 #endif
28794 
28795 /* ImportFrom */
28796 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
28797  PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
28798  if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
28799  PyErr_Format(PyExc_ImportError,
28800  #if PY_MAJOR_VERSION < 3
28801  "cannot import name %.230s", PyString_AS_STRING(name));
28802  #else
28803  "cannot import name %S", name);
28804  #endif
28805  }
28806  return value;
28807 }
28808 
28809 /* HasAttr */
28810 static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
28811  PyObject *r;
28812  if (unlikely(!__Pyx_PyBaseString_Check(n))) {
28813  PyErr_SetString(PyExc_TypeError,
28814  "hasattr(): attribute name must be string");
28815  return -1;
28816  }
28817  r = __Pyx_GetAttr(o, n);
28818  if (unlikely(!r)) {
28819  PyErr_Clear();
28820  return 0;
28821  } else {
28822  Py_DECREF(r);
28823  return 1;
28824  }
28825 }
28826 
28827 /* PyObject_GenericGetAttrNoDict */
28828 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
28829 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
28830  PyErr_Format(PyExc_AttributeError,
28831 #if PY_MAJOR_VERSION >= 3
28832  "'%.50s' object has no attribute '%U'",
28833  tp->tp_name, attr_name);
28834 #else
28835  "'%.50s' object has no attribute '%.400s'",
28836  tp->tp_name, PyString_AS_STRING(attr_name));
28837 #endif
28838  return NULL;
28839 }
28840 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
28841  PyObject *descr;
28842  PyTypeObject *tp = Py_TYPE(obj);
28843  if (unlikely(!PyString_Check(attr_name))) {
28844  return PyObject_GenericGetAttr(obj, attr_name);
28845  }
28846  assert(!tp->tp_dictoffset);
28847  descr = _PyType_Lookup(tp, attr_name);
28848  if (unlikely(!descr)) {
28849  return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
28850  }
28851  Py_INCREF(descr);
28852  #if PY_MAJOR_VERSION < 3
28853  if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
28854  #endif
28855  {
28856  descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
28857  if (unlikely(f)) {
28858  PyObject *res = f(descr, obj, (PyObject *)tp);
28859  Py_DECREF(descr);
28860  return res;
28861  }
28862  }
28863  return descr;
28864 }
28865 #endif
28866 
28867 /* PyObject_GenericGetAttr */
28868 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
28869 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
28870  if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
28871  return PyObject_GenericGetAttr(obj, attr_name);
28872  }
28873  return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
28874 }
28875 #endif
28876 
28877 /* SetVTable */
28878 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
28879 #if PY_VERSION_HEX >= 0x02070000
28880  PyObject *ob = PyCapsule_New(vtable, 0, 0);
28881 #else
28882  PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
28883 #endif
28884  if (!ob)
28885  goto bad;
28886  if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
28887  goto bad;
28888  Py_DECREF(ob);
28889  return 0;
28890 bad:
28891  Py_XDECREF(ob);
28892  return -1;
28893 }
28894 
28895 /* PyObjectGetAttrStrNoError */
28896 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
28897  __Pyx_PyThreadState_declare
28898  __Pyx_PyThreadState_assign
28899  if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
28900  __Pyx_PyErr_Clear();
28901 }
28902 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
28903  PyObject *result;
28904 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
28905  PyTypeObject* tp = Py_TYPE(obj);
28906  if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
28907  return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
28908  }
28909 #endif
28910  result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
28911  if (unlikely(!result)) {
28912  __Pyx_PyObject_GetAttrStr_ClearAttributeError();
28913  }
28914  return result;
28915 }
28916 
28917 /* SetupReduce */
28918 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
28919  int ret;
28920  PyObject *name_attr;
28921  name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
28922  if (likely(name_attr)) {
28923  ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
28924  } else {
28925  ret = -1;
28926  }
28927  if (unlikely(ret < 0)) {
28928  PyErr_Clear();
28929  ret = 0;
28930  }
28931  Py_XDECREF(name_attr);
28932  return ret;
28933 }
28934 static int __Pyx_setup_reduce(PyObject* type_obj) {
28935  int ret = 0;
28936  PyObject *object_reduce = NULL;
28937  PyObject *object_getstate = NULL;
28938  PyObject *object_reduce_ex = NULL;
28939  PyObject *reduce = NULL;
28940  PyObject *reduce_ex = NULL;
28941  PyObject *reduce_cython = NULL;
28942  PyObject *setstate = NULL;
28943  PyObject *setstate_cython = NULL;
28944  PyObject *getstate = NULL;
28945 #if CYTHON_USE_PYTYPE_LOOKUP
28946  getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
28947 #else
28948  getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
28949  if (!getstate && PyErr_Occurred()) {
28950  goto __PYX_BAD;
28951  }
28952 #endif
28953  if (getstate) {
28954 #if CYTHON_USE_PYTYPE_LOOKUP
28955  object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
28956 #else
28957  object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
28958  if (!object_getstate && PyErr_Occurred()) {
28959  goto __PYX_BAD;
28960  }
28961 #endif
28962  if (object_getstate != getstate) {
28963  goto __PYX_GOOD;
28964  }
28965  }
28966 #if CYTHON_USE_PYTYPE_LOOKUP
28967  object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
28968 #else
28969  object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
28970 #endif
28971  reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
28972  if (reduce_ex == object_reduce_ex) {
28973 #if CYTHON_USE_PYTYPE_LOOKUP
28974  object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
28975 #else
28976  object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
28977 #endif
28978  reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
28979  if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
28980  reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
28981  if (likely(reduce_cython)) {
28982  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
28983  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
28984  } else if (reduce == object_reduce || PyErr_Occurred()) {
28985  goto __PYX_BAD;
28986  }
28987  setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
28988  if (!setstate) PyErr_Clear();
28989  if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
28990  setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
28991  if (likely(setstate_cython)) {
28992  ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
28993  ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
28994  } else if (!setstate || PyErr_Occurred()) {
28995  goto __PYX_BAD;
28996  }
28997  }
28998  PyType_Modified((PyTypeObject*)type_obj);
28999  }
29000  }
29001  goto __PYX_GOOD;
29002 __PYX_BAD:
29003  if (!PyErr_Occurred())
29004  PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
29005  ret = -1;
29006 __PYX_GOOD:
29007 #if !CYTHON_USE_PYTYPE_LOOKUP
29008  Py_XDECREF(object_reduce);
29009  Py_XDECREF(object_reduce_ex);
29010  Py_XDECREF(object_getstate);
29011  Py_XDECREF(getstate);
29012 #endif
29013  Py_XDECREF(reduce);
29014  Py_XDECREF(reduce_ex);
29015  Py_XDECREF(reduce_cython);
29016  Py_XDECREF(setstate);
29017  Py_XDECREF(setstate_cython);
29018  return ret;
29019 }
29020 
29021 /* FetchCommonType */
29022 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
29023  PyObject* fake_module;
29024  PyTypeObject* cached_type = NULL;
29025  fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
29026  if (!fake_module) return NULL;
29027  Py_INCREF(fake_module);
29028  cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
29029  if (cached_type) {
29030  if (!PyType_Check((PyObject*)cached_type)) {
29031  PyErr_Format(PyExc_TypeError,
29032  "Shared Cython type %.200s is not a type object",
29033  type->tp_name);
29034  goto bad;
29035  }
29036  if (cached_type->tp_basicsize != type->tp_basicsize) {
29037  PyErr_Format(PyExc_TypeError,
29038  "Shared Cython type %.200s has the wrong size, try recompiling",
29039  type->tp_name);
29040  goto bad;
29041  }
29042  } else {
29043  if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
29044  PyErr_Clear();
29045  if (PyType_Ready(type) < 0) goto bad;
29046  if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
29047  goto bad;
29048  Py_INCREF(type);
29049  cached_type = type;
29050  }
29051 done:
29052  Py_DECREF(fake_module);
29053  return cached_type;
29054 bad:
29055  Py_XDECREF(cached_type);
29056  cached_type = NULL;
29057  goto done;
29058 }
29059 
29060 /* CythonFunctionShared */
29061 #include <structmember.h>
29062 static PyObject *
29063 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
29064 {
29065  if (unlikely(op->func_doc == NULL)) {
29066  if (op->func.m_ml->ml_doc) {
29067 #if PY_MAJOR_VERSION >= 3
29068  op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
29069 #else
29070  op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
29071 #endif
29072  if (unlikely(op->func_doc == NULL))
29073  return NULL;
29074  } else {
29075  Py_INCREF(Py_None);
29076  return Py_None;
29077  }
29078  }
29079  Py_INCREF(op->func_doc);
29080  return op->func_doc;
29081 }
29082 static int
29083 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
29084 {
29085  PyObject *tmp = op->func_doc;
29086  if (value == NULL) {
29087  value = Py_None;
29088  }
29089  Py_INCREF(value);
29090  op->func_doc = value;
29091  Py_XDECREF(tmp);
29092  return 0;
29093 }
29094 static PyObject *
29095 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29096 {
29097  if (unlikely(op->func_name == NULL)) {
29098 #if PY_MAJOR_VERSION >= 3
29099  op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
29100 #else
29101  op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
29102 #endif
29103  if (unlikely(op->func_name == NULL))
29104  return NULL;
29105  }
29106  Py_INCREF(op->func_name);
29107  return op->func_name;
29108 }
29109 static int
29110 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
29111 {
29112  PyObject *tmp;
29113 #if PY_MAJOR_VERSION >= 3
29114  if (unlikely(value == NULL || !PyUnicode_Check(value)))
29115 #else
29116  if (unlikely(value == NULL || !PyString_Check(value)))
29117 #endif
29118  {
29119  PyErr_SetString(PyExc_TypeError,
29120  "__name__ must be set to a string object");
29121  return -1;
29122  }
29123  tmp = op->func_name;
29124  Py_INCREF(value);
29125  op->func_name = value;
29126  Py_XDECREF(tmp);
29127  return 0;
29128 }
29129 static PyObject *
29130 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29131 {
29132  Py_INCREF(op->func_qualname);
29133  return op->func_qualname;
29134 }
29135 static int
29136 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
29137 {
29138  PyObject *tmp;
29139 #if PY_MAJOR_VERSION >= 3
29140  if (unlikely(value == NULL || !PyUnicode_Check(value)))
29141 #else
29142  if (unlikely(value == NULL || !PyString_Check(value)))
29143 #endif
29144  {
29145  PyErr_SetString(PyExc_TypeError,
29146  "__qualname__ must be set to a string object");
29147  return -1;
29148  }
29149  tmp = op->func_qualname;
29150  Py_INCREF(value);
29151  op->func_qualname = value;
29152  Py_XDECREF(tmp);
29153  return 0;
29154 }
29155 static PyObject *
29156 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
29157 {
29158  PyObject *self;
29159  self = m->func_closure;
29160  if (self == NULL)
29161  self = Py_None;
29162  Py_INCREF(self);
29163  return self;
29164 }
29165 static PyObject *
29166 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29167 {
29168  if (unlikely(op->func_dict == NULL)) {
29169  op->func_dict = PyDict_New();
29170  if (unlikely(op->func_dict == NULL))
29171  return NULL;
29172  }
29173  Py_INCREF(op->func_dict);
29174  return op->func_dict;
29175 }
29176 static int
29177 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED void *context)
29178 {
29179  PyObject *tmp;
29180  if (unlikely(value == NULL)) {
29181  PyErr_SetString(PyExc_TypeError,
29182  "function's dictionary may not be deleted");
29183  return -1;
29184  }
29185  if (unlikely(!PyDict_Check(value))) {
29186  PyErr_SetString(PyExc_TypeError,
29187  "setting function's dictionary to a non-dict");
29188  return -1;
29189  }
29190  tmp = op->func_dict;
29191  Py_INCREF(value);
29192  op->func_dict = value;
29193  Py_XDECREF(tmp);
29194  return 0;
29195 }
29196 static PyObject *
29197 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29198 {
29199  Py_INCREF(op->func_globals);
29200  return op->func_globals;
29201 }
29202 static PyObject *
29203 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29204 {
29205  Py_INCREF(Py_None);
29206  return Py_None;
29207 }
29208 static PyObject *
29209 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context)
29210 {
29211  PyObject* result = (op->func_code) ? op->func_code : Py_None;
29212  Py_INCREF(result);
29213  return result;
29214 }
29215 static int
29216 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
29217  int result = 0;
29218  PyObject *res = op->defaults_getter((PyObject *) op);
29219  if (unlikely(!res))
29220  return -1;
29221  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29222  op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
29223  Py_INCREF(op->defaults_tuple);
29224  op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
29225  Py_INCREF(op->defaults_kwdict);
29226  #else
29227  op->defaults_tuple = PySequence_ITEM(res, 0);
29228  if (unlikely(!op->defaults_tuple)) result = -1;
29229  else {
29230  op->defaults_kwdict = PySequence_ITEM(res, 1);
29231  if (unlikely(!op->defaults_kwdict)) result = -1;
29232  }
29233  #endif
29234  Py_DECREF(res);
29235  return result;
29236 }
29237 static int
29238 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
29239  PyObject* tmp;
29240  if (!value) {
29241  value = Py_None;
29242  } else if (value != Py_None && !PyTuple_Check(value)) {
29243  PyErr_SetString(PyExc_TypeError,
29244  "__defaults__ must be set to a tuple object");
29245  return -1;
29246  }
29247  Py_INCREF(value);
29248  tmp = op->defaults_tuple;
29249  op->defaults_tuple = value;
29250  Py_XDECREF(tmp);
29251  return 0;
29252 }
29253 static PyObject *
29254 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
29255  PyObject* result = op->defaults_tuple;
29256  if (unlikely(!result)) {
29257  if (op->defaults_getter) {
29258  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
29259  result = op->defaults_tuple;
29260  } else {
29261  result = Py_None;
29262  }
29263  }
29264  Py_INCREF(result);
29265  return result;
29266 }
29267 static int
29268 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
29269  PyObject* tmp;
29270  if (!value) {
29271  value = Py_None;
29272  } else if (value != Py_None && !PyDict_Check(value)) {
29273  PyErr_SetString(PyExc_TypeError,
29274  "__kwdefaults__ must be set to a dict object");
29275  return -1;
29276  }
29277  Py_INCREF(value);
29278  tmp = op->defaults_kwdict;
29279  op->defaults_kwdict = value;
29280  Py_XDECREF(tmp);
29281  return 0;
29282 }
29283 static PyObject *
29284 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
29285  PyObject* result = op->defaults_kwdict;
29286  if (unlikely(!result)) {
29287  if (op->defaults_getter) {
29288  if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
29289  result = op->defaults_kwdict;
29290  } else {
29291  result = Py_None;
29292  }
29293  }
29294  Py_INCREF(result);
29295  return result;
29296 }
29297 static int
29298 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED void *context) {
29299  PyObject* tmp;
29300  if (!value || value == Py_None) {
29301  value = NULL;
29302  } else if (!PyDict_Check(value)) {
29303  PyErr_SetString(PyExc_TypeError,
29304  "__annotations__ must be set to a dict object");
29305  return -1;
29306  }
29307  Py_XINCREF(value);
29308  tmp = op->func_annotations;
29309  op->func_annotations = value;
29310  Py_XDECREF(tmp);
29311  return 0;
29312 }
29313 static PyObject *
29314 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *context) {
29315  PyObject* result = op->func_annotations;
29316  if (unlikely(!result)) {
29317  result = PyDict_New();
29318  if (unlikely(!result)) return NULL;
29319  op->func_annotations = result;
29320  }
29321  Py_INCREF(result);
29322  return result;
29323 }
29324 static PyGetSetDef __pyx_CyFunction_getsets[] = {
29325  {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
29326  {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
29327  {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
29328  {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
29329  {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
29330  {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
29331  {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
29332  {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
29333  {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
29334  {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
29335  {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
29336  {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
29337  {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
29338  {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
29339  {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
29340  {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
29341  {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
29342  {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
29343  {0, 0, 0, 0, 0}
29344 };
29345 static PyMemberDef __pyx_CyFunction_members[] = {
29346  {(char *) "__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
29347  {0, 0, 0, 0, 0}
29348 };
29349 static PyObject *
29350 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
29351 {
29352 #if PY_MAJOR_VERSION >= 3
29353  Py_INCREF(m->func_qualname);
29354  return m->func_qualname;
29355 #else
29356  return PyString_FromString(m->func.m_ml->ml_name);
29357 #endif
29358 }
29359 static PyMethodDef __pyx_CyFunction_methods[] = {
29360  {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
29361  {0, 0, 0, 0}
29362 };
29363 #if PY_VERSION_HEX < 0x030500A0
29364 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
29365 #else
29366 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
29367 #endif
29368 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml, int flags, PyObject* qualname,
29369  PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
29370  if (unlikely(op == NULL))
29371  return NULL;
29372  op->flags = flags;
29373  __Pyx_CyFunction_weakreflist(op) = NULL;
29374  op->func.m_ml = ml;
29375  op->func.m_self = (PyObject *) op;
29376  Py_XINCREF(closure);
29377  op->func_closure = closure;
29378  Py_XINCREF(module);
29379  op->func.m_module = module;
29380  op->func_dict = NULL;
29381  op->func_name = NULL;
29382  Py_INCREF(qualname);
29383  op->func_qualname = qualname;
29384  op->func_doc = NULL;
29385  op->func_classobj = NULL;
29386  op->func_globals = globals;
29387  Py_INCREF(op->func_globals);
29388  Py_XINCREF(code);
29389  op->func_code = code;
29390  op->defaults_pyobjects = 0;
29391  op->defaults_size = 0;
29392  op->defaults = NULL;
29393  op->defaults_tuple = NULL;
29394  op->defaults_kwdict = NULL;
29395  op->defaults_getter = NULL;
29396  op->func_annotations = NULL;
29397  return (PyObject *) op;
29398 }
29399 static int
29400 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
29401 {
29402  Py_CLEAR(m->func_closure);
29403  Py_CLEAR(m->func.m_module);
29404  Py_CLEAR(m->func_dict);
29405  Py_CLEAR(m->func_name);
29406  Py_CLEAR(m->func_qualname);
29407  Py_CLEAR(m->func_doc);
29408  Py_CLEAR(m->func_globals);
29409  Py_CLEAR(m->func_code);
29410  Py_CLEAR(m->func_classobj);
29411  Py_CLEAR(m->defaults_tuple);
29412  Py_CLEAR(m->defaults_kwdict);
29413  Py_CLEAR(m->func_annotations);
29414  if (m->defaults) {
29415  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
29416  int i;
29417  for (i = 0; i < m->defaults_pyobjects; i++)
29418  Py_XDECREF(pydefaults[i]);
29419  PyObject_Free(m->defaults);
29420  m->defaults = NULL;
29421  }
29422  return 0;
29423 }
29424 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
29425 {
29426  if (__Pyx_CyFunction_weakreflist(m) != NULL)
29427  PyObject_ClearWeakRefs((PyObject *) m);
29428  __Pyx_CyFunction_clear(m);
29429  PyObject_GC_Del(m);
29430 }
29431 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
29432 {
29433  PyObject_GC_UnTrack(m);
29434  __Pyx__CyFunction_dealloc(m);
29435 }
29436 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
29437 {
29438  Py_VISIT(m->func_closure);
29439  Py_VISIT(m->func.m_module);
29440  Py_VISIT(m->func_dict);
29441  Py_VISIT(m->func_name);
29442  Py_VISIT(m->func_qualname);
29443  Py_VISIT(m->func_doc);
29444  Py_VISIT(m->func_globals);
29445  Py_VISIT(m->func_code);
29446  Py_VISIT(m->func_classobj);
29447  Py_VISIT(m->defaults_tuple);
29448  Py_VISIT(m->defaults_kwdict);
29449  if (m->defaults) {
29450  PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
29451  int i;
29452  for (i = 0; i < m->defaults_pyobjects; i++)
29453  Py_VISIT(pydefaults[i]);
29454  }
29455  return 0;
29456 }
29457 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
29458 {
29459 #if PY_MAJOR_VERSION < 3
29460  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29461  if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
29462  Py_INCREF(func);
29463  return func;
29464  }
29465  if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
29466  if (type == NULL)
29467  type = (PyObject *)(Py_TYPE(obj));
29468  return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
29469  }
29470  if (obj == Py_None)
29471  obj = NULL;
29472 #endif
29473  return __Pyx_PyMethod_New(func, obj, type);
29474 }
29475 static PyObject*
29476 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
29477 {
29478 #if PY_MAJOR_VERSION >= 3
29479  return PyUnicode_FromFormat("<cyfunction %U at %p>",
29480  op->func_qualname, (void *)op);
29481 #else
29482  return PyString_FromFormat("<cyfunction %s at %p>",
29483  PyString_AsString(op->func_qualname), (void *)op);
29484 #endif
29485 }
29486 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
29487  PyCFunctionObject* f = (PyCFunctionObject*)func;
29488  PyCFunction meth = f->m_ml->ml_meth;
29489  Py_ssize_t size;
29490  switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
29491  case METH_VARARGS:
29492  if (likely(kw == NULL || PyDict_Size(kw) == 0))
29493  return (*meth)(self, arg);
29494  break;
29495  case METH_VARARGS | METH_KEYWORDS:
29496  return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw);
29497  case METH_NOARGS:
29498  if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
29499  size = PyTuple_GET_SIZE(arg);
29500  if (likely(size == 0))
29501  return (*meth)(self, NULL);
29502  PyErr_Format(PyExc_TypeError,
29503  "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
29504  f->m_ml->ml_name, size);
29505  return NULL;
29506  }
29507  break;
29508  case METH_O:
29509  if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
29510  size = PyTuple_GET_SIZE(arg);
29511  if (likely(size == 1)) {
29512  PyObject *result, *arg0;
29513  #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
29514  arg0 = PyTuple_GET_ITEM(arg, 0);
29515  #else
29516  arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL;
29517  #endif
29518  result = (*meth)(self, arg0);
29519  #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
29520  Py_DECREF(arg0);
29521  #endif
29522  return result;
29523  }
29524  PyErr_Format(PyExc_TypeError,
29525  "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
29526  f->m_ml->ml_name, size);
29527  return NULL;
29528  }
29529  break;
29530  default:
29531  PyErr_SetString(PyExc_SystemError, "Bad call flags in "
29532  "__Pyx_CyFunction_Call. METH_OLDARGS is no "
29533  "longer supported!");
29534  return NULL;
29535  }
29536  PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
29537  f->m_ml->ml_name);
29538  return NULL;
29539 }
29540 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
29541  return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
29542 }
29543 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
29544  PyObject *result;
29545  __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
29546  if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
29547  Py_ssize_t argc;
29548  PyObject *new_args;
29549  PyObject *self;
29550  argc = PyTuple_GET_SIZE(args);
29551  new_args = PyTuple_GetSlice(args, 1, argc);
29552  if (unlikely(!new_args))
29553  return NULL;
29554  self = PyTuple_GetItem(args, 0);
29555  if (unlikely(!self)) {
29556  Py_DECREF(new_args);
29557 #if PY_MAJOR_VERSION > 2
29558  PyErr_Format(PyExc_TypeError,
29559  "unbound method %.200S() needs an argument",
29560  cyfunc->func_qualname);
29561 #else
29562  PyErr_SetString(PyExc_TypeError,
29563  "unbound method needs an argument");
29564 #endif
29565  return NULL;
29566  }
29567  result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
29568  Py_DECREF(new_args);
29569  } else {
29570  result = __Pyx_CyFunction_Call(func, args, kw);
29571  }
29572  return result;
29573 }
29574 static PyTypeObject __pyx_CyFunctionType_type = {
29575  PyVarObject_HEAD_INIT(0, 0)
29576  "cython_function_or_method",
29577  sizeof(__pyx_CyFunctionObject),
29578  0,
29579  (destructor) __Pyx_CyFunction_dealloc,
29580  0,
29581  0,
29582  0,
29583 #if PY_MAJOR_VERSION < 3
29584  0,
29585 #else
29586  0,
29587 #endif
29588  (reprfunc) __Pyx_CyFunction_repr,
29589  0,
29590  0,
29591  0,
29592  0,
29593  __Pyx_CyFunction_CallAsMethod,
29594  0,
29595  0,
29596  0,
29597  0,
29598  Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
29599  0,
29600  (traverseproc) __Pyx_CyFunction_traverse,
29601  (inquiry) __Pyx_CyFunction_clear,
29602  0,
29603 #if PY_VERSION_HEX < 0x030500A0
29604  offsetof(__pyx_CyFunctionObject, func_weakreflist),
29605 #else
29606  offsetof(PyCFunctionObject, m_weakreflist),
29607 #endif
29608  0,
29609  0,
29610  __pyx_CyFunction_methods,
29611  __pyx_CyFunction_members,
29612  __pyx_CyFunction_getsets,
29613  0,
29614  0,
29615  __Pyx_CyFunction_descr_get,
29616  0,
29617  offsetof(__pyx_CyFunctionObject, func_dict),
29618  0,
29619  0,
29620  0,
29621  0,
29622  0,
29623  0,
29624  0,
29625  0,
29626  0,
29627  0,
29628  0,
29629  0,
29630 #if PY_VERSION_HEX >= 0x030400a1
29631  0,
29632 #endif
29633 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
29634  0,
29635 #endif
29636 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
29637  0,
29638 #endif
29639 #if PY_VERSION_HEX >= 0x030C0000
29640  0,
29641 #endif
29642 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
29643  0,
29644 #endif
29645 };
29646 static int __pyx_CyFunction_init(void) {
29647  __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
29648  if (unlikely(__pyx_CyFunctionType == NULL)) {
29649  return -1;
29650  }
29651  return 0;
29652 }
29653 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
29654  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29655  m->defaults = PyObject_Malloc(size);
29656  if (unlikely(!m->defaults))
29657  return PyErr_NoMemory();
29658  memset(m->defaults, 0, size);
29659  m->defaults_pyobjects = pyobjects;
29660  m->defaults_size = size;
29661  return m->defaults;
29662 }
29663 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
29664  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29665  m->defaults_tuple = tuple;
29666  Py_INCREF(tuple);
29667 }
29668 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
29669  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29670  m->defaults_kwdict = dict;
29671  Py_INCREF(dict);
29672 }
29673 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
29674  __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
29675  m->func_annotations = dict;
29676  Py_INCREF(dict);
29677 }
29678 
29679 /* CythonFunction */
29680 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname,
29681  PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
29682  PyObject *op = __Pyx_CyFunction_Init(
29683  PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
29684  ml, flags, qualname, closure, module, globals, code
29685  );
29686  if (likely(op)) {
29687  PyObject_GC_Track(op);
29688  }
29689  return op;
29690 }
29691 
29692 /* CLineInTraceback */
29693 #ifndef CYTHON_CLINE_IN_TRACEBACK
29694 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate, int c_line) {
29695  PyObject *use_cline;
29696  PyObject *ptype, *pvalue, *ptraceback;
29697 #if CYTHON_COMPILING_IN_CPYTHON
29698  PyObject **cython_runtime_dict;
29699 #endif
29700  if (unlikely(!__pyx_cython_runtime)) {
29701  return c_line;
29702  }
29703  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
29704 #if CYTHON_COMPILING_IN_CPYTHON
29705  cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
29706  if (likely(cython_runtime_dict)) {
29707  __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
29708  use_cline, *cython_runtime_dict,
29709  __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
29710  } else
29711 #endif
29712  {
29713  PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
29714  if (use_cline_obj) {
29715  use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
29716  Py_DECREF(use_cline_obj);
29717  } else {
29718  PyErr_Clear();
29719  use_cline = NULL;
29720  }
29721  }
29722  if (!use_cline) {
29723  c_line = 0;
29724  (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
29725  }
29726  else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
29727  c_line = 0;
29728  }
29729  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
29730  return c_line;
29731 }
29732 #endif
29733 
29734 /* CodeObjectCache */
29735 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
29736  int start = 0, mid = 0, end = count - 1;
29737  if (end >= 0 && code_line > entries[end].code_line) {
29738  return count;
29739  }
29740  while (start < end) {
29741  mid = start + (end - start) / 2;
29742  if (code_line < entries[mid].code_line) {
29743  end = mid;
29744  } else if (code_line > entries[mid].code_line) {
29745  start = mid + 1;
29746  } else {
29747  return mid;
29748  }
29749  }
29750  if (code_line <= entries[mid].code_line) {
29751  return mid;
29752  } else {
29753  return mid + 1;
29754  }
29755 }
29756 static PyCodeObject *__pyx_find_code_object(int code_line) {
29757  PyCodeObject* code_object;
29758  int pos;
29759  if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
29760  return NULL;
29761  }
29762  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
29763  if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
29764  return NULL;
29765  }
29766  code_object = __pyx_code_cache.entries[pos].code_object;
29767  Py_INCREF(code_object);
29768  return code_object;
29769 }
29770 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
29771  int pos, i;
29772  __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
29773  if (unlikely(!code_line)) {
29774  return;
29775  }
29776  if (unlikely(!entries)) {
29777  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
29778  if (likely(entries)) {
29779  __pyx_code_cache.entries = entries;
29780  __pyx_code_cache.max_count = 64;
29781  __pyx_code_cache.count = 1;
29782  entries[0].code_line = code_line;
29783  entries[0].code_object = code_object;
29784  Py_INCREF(code_object);
29785  }
29786  return;
29787  }
29788  pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
29789  if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
29790  PyCodeObject* tmp = entries[pos].code_object;
29791  entries[pos].code_object = code_object;
29792  Py_DECREF(tmp);
29793  return;
29794  }
29795  if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
29796  int new_max = __pyx_code_cache.max_count + 64;
29797  entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
29798  __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
29799  if (unlikely(!entries)) {
29800  return;
29801  }
29802  __pyx_code_cache.entries = entries;
29803  __pyx_code_cache.max_count = new_max;
29804  }
29805  for (i=__pyx_code_cache.count; i>pos; i--) {
29806  entries[i] = entries[i-1];
29807  }
29808  entries[pos].code_line = code_line;
29809  entries[pos].code_object = code_object;
29810  __pyx_code_cache.count++;
29811  Py_INCREF(code_object);
29812 }
29813 
29814 /* AddTraceback */
29815 #include "compile.h"
29816 #include "frameobject.h"
29817 #include "traceback.h"
29818 #if PY_VERSION_HEX >= 0x030b00a6
29819  #ifndef Py_BUILD_CORE
29820  #define Py_BUILD_CORE 1
29821  #endif
29822  #include "internal/pycore_frame.h"
29823 #endif
29824 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
29825  const char *funcname, int c_line,
29826  int py_line, const char *filename) {
29827  PyCodeObject *py_code = NULL;
29828  PyObject *py_funcname = NULL;
29829  #if PY_MAJOR_VERSION < 3
29830  PyObject *py_srcfile = NULL;
29831  py_srcfile = PyString_FromString(filename);
29832  if (!py_srcfile) goto bad;
29833  #endif
29834  if (c_line) {
29835  #if PY_MAJOR_VERSION < 3
29836  py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
29837  if (!py_funcname) goto bad;
29838  #else
29839  py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
29840  if (!py_funcname) goto bad;
29841  funcname = PyUnicode_AsUTF8(py_funcname);
29842  if (!funcname) goto bad;
29843  #endif
29844  }
29845  else {
29846  #if PY_MAJOR_VERSION < 3
29847  py_funcname = PyString_FromString(funcname);
29848  if (!py_funcname) goto bad;
29849  #endif
29850  }
29851  #if PY_MAJOR_VERSION < 3
29852  py_code = __Pyx_PyCode_New(
29853  0,
29854  0,
29855  0,
29856  0,
29857  0,
29858  __pyx_empty_bytes, /*PyObject *code,*/
29859  __pyx_empty_tuple, /*PyObject *consts,*/
29860  __pyx_empty_tuple, /*PyObject *names,*/
29861  __pyx_empty_tuple, /*PyObject *varnames,*/
29862  __pyx_empty_tuple, /*PyObject *freevars,*/
29863  __pyx_empty_tuple, /*PyObject *cellvars,*/
29864  py_srcfile, /*PyObject *filename,*/
29865  py_funcname, /*PyObject *name,*/
29866  py_line,
29867  __pyx_empty_bytes /*PyObject *lnotab*/
29868  );
29869  Py_DECREF(py_srcfile);
29870  #else
29871  py_code = PyCode_NewEmpty(filename, funcname, py_line);
29872  #endif
29873  Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline
29874  return py_code;
29875 bad:
29876  Py_XDECREF(py_funcname);
29877  #if PY_MAJOR_VERSION < 3
29878  Py_XDECREF(py_srcfile);
29879  #endif
29880  return NULL;
29881 }
29882 static void __Pyx_AddTraceback(const char *funcname, int c_line,
29883  int py_line, const char *filename) {
29884  PyCodeObject *py_code = 0;
29885  PyFrameObject *py_frame = 0;
29886  PyThreadState *tstate = __Pyx_PyThreadState_Current;
29887  PyObject *ptype, *pvalue, *ptraceback;
29888  if (c_line) {
29889  c_line = __Pyx_CLineForTraceback(tstate, c_line);
29890  }
29891  py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
29892  if (!py_code) {
29893  __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
29894  py_code = __Pyx_CreateCodeObjectForTraceback(
29895  funcname, c_line, py_line, filename);
29896  if (!py_code) {
29897  /* If the code object creation fails, then we should clear the
29898  fetched exception references and propagate the new exception */
29899  Py_XDECREF(ptype);
29900  Py_XDECREF(pvalue);
29901  Py_XDECREF(ptraceback);
29902  goto bad;
29903  }
29904  __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
29905  __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
29906  }
29907  py_frame = PyFrame_New(
29908  tstate, /*PyThreadState *tstate,*/
29909  py_code, /*PyCodeObject *code,*/
29910  __pyx_d, /*PyObject *globals,*/
29911  0 /*PyObject *locals*/
29912  );
29913  if (!py_frame) goto bad;
29914  __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
29915  PyTraceBack_Here(py_frame);
29916 bad:
29917  Py_XDECREF(py_code);
29918  Py_XDECREF(py_frame);
29919 }
29920 
29921 #if PY_MAJOR_VERSION < 3
29922 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
29923  if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
29924  if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
29925  if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
29926  PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
29927  return -1;
29928 }
29929 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
29930  PyObject *obj = view->obj;
29931  if (!obj) return;
29932  if (PyObject_CheckBuffer(obj)) {
29933  PyBuffer_Release(view);
29934  return;
29935  }
29936  if ((0)) {}
29937  view->obj = NULL;
29938  Py_DECREF(obj);
29939 }
29940 #endif
29941 
29942 
29943 /* MemviewSliceIsContig */
29944 static int
29945 __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
29946 {
29947  int i, index, step, start;
29948  Py_ssize_t itemsize = mvs.memview->view.itemsize;
29949  if (order == 'F') {
29950  step = 1;
29951  start = 0;
29952  } else {
29953  step = -1;
29954  start = ndim - 1;
29955  }
29956  for (i = 0; i < ndim; i++) {
29957  index = start + step * i;
29958  if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
29959  return 0;
29960  itemsize *= mvs.shape[index];
29961  }
29962  return 1;
29963 }
29964 
29965 /* OverlappingSlices */
29966 static void
29967 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
29968  void **out_start, void **out_end,
29969  int ndim, size_t itemsize)
29970 {
29971  char *start, *end;
29972  int i;
29973  start = end = slice->data;
29974  for (i = 0; i < ndim; i++) {
29975  Py_ssize_t stride = slice->strides[i];
29976  Py_ssize_t extent = slice->shape[i];
29977  if (extent == 0) {
29978  *out_start = *out_end = start;
29979  return;
29980  } else {
29981  if (stride > 0)
29982  end += stride * (extent - 1);
29983  else
29984  start += stride * (extent - 1);
29985  }
29986  }
29987  *out_start = start;
29988  *out_end = end + itemsize;
29989 }
29990 static int
29991 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
29992  __Pyx_memviewslice *slice2,
29993  int ndim, size_t itemsize)
29994 {
29995  void *start1, *end1, *start2, *end2;
29996  __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
29997  __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
29998  return (start1 < end2) && (start2 < end1);
29999 }
30000 
30001 /* Capsule */
30002 static CYTHON_INLINE PyObject *
30003 __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
30004 {
30005  PyObject *cobj;
30006 #if PY_VERSION_HEX >= 0x02070000
30007  cobj = PyCapsule_New(p, sig, NULL);
30008 #else
30009  cobj = PyCObject_FromVoidPtr(p, NULL);
30010 #endif
30011  return cobj;
30012 }
30013 
30014 /* IsLittleEndian */
30015 static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
30016 {
30017  union {
30018  uint32_t u32;
30019  uint8_t u8[4];
30020  } S;
30021  S.u32 = 0x01020304;
30022  return S.u8[0] == 4;
30023 }
30024 
30025 /* BufferFormatCheck */
30026 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
30027  __Pyx_BufFmt_StackElem* stack,
30028  __Pyx_TypeInfo* type) {
30029  stack[0].field = &ctx->root;
30030  stack[0].parent_offset = 0;
30031  ctx->root.type = type;
30032  ctx->root.name = "buffer dtype";
30033  ctx->root.offset = 0;
30034  ctx->head = stack;
30035  ctx->head->field = &ctx->root;
30036  ctx->fmt_offset = 0;
30037  ctx->head->parent_offset = 0;
30038  ctx->new_packmode = '@';
30039  ctx->enc_packmode = '@';
30040  ctx->new_count = 1;
30041  ctx->enc_count = 0;
30042  ctx->enc_type = 0;
30043  ctx->is_complex = 0;
30044  ctx->is_valid_array = 0;
30045  ctx->struct_alignment = 0;
30046  while (type->typegroup == 'S') {
30047  ++ctx->head;
30048  ctx->head->field = type->fields;
30049  ctx->head->parent_offset = 0;
30050  type = type->fields->type;
30051  }
30052 }
30053 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
30054  int count;
30055  const char* t = *ts;
30056  if (*t < '0' || *t > '9') {
30057  return -1;
30058  } else {
30059  count = *t++ - '0';
30060  while (*t >= '0' && *t <= '9') {
30061  count *= 10;
30062  count += *t++ - '0';
30063  }
30064  }
30065  *ts = t;
30066  return count;
30067 }
30068 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
30069  int number = __Pyx_BufFmt_ParseNumber(ts);
30070  if (number == -1)
30071  PyErr_Format(PyExc_ValueError,\
30072  "Does not understand character buffer dtype format string ('%c')", **ts);
30073  return number;
30074 }
30075 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
30076  PyErr_Format(PyExc_ValueError,
30077  "Unexpected format string character: '%c'", ch);
30078 }
30079 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
30080  switch (ch) {
30081  case '?': return "'bool'";
30082  case 'c': return "'char'";
30083  case 'b': return "'signed char'";
30084  case 'B': return "'unsigned char'";
30085  case 'h': return "'short'";
30086  case 'H': return "'unsigned short'";
30087  case 'i': return "'int'";
30088  case 'I': return "'unsigned int'";
30089  case 'l': return "'long'";
30090  case 'L': return "'unsigned long'";
30091  case 'q': return "'long long'";
30092  case 'Q': return "'unsigned long long'";
30093  case 'f': return (is_complex ? "'complex float'" : "'float'");
30094  case 'd': return (is_complex ? "'complex double'" : "'double'");
30095  case 'g': return (is_complex ? "'complex long double'" : "'long double'");
30096  case 'T': return "a struct";
30097  case 'O': return "Python object";
30098  case 'P': return "a pointer";
30099  case 's': case 'p': return "a string";
30100  case 0: return "end";
30101  default: return "unparseable format string";
30102  }
30103 }
30104 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
30105  switch (ch) {
30106  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
30107  case 'h': case 'H': return 2;
30108  case 'i': case 'I': case 'l': case 'L': return 4;
30109  case 'q': case 'Q': return 8;
30110  case 'f': return (is_complex ? 8 : 4);
30111  case 'd': return (is_complex ? 16 : 8);
30112  case 'g': {
30113  PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
30114  return 0;
30115  }
30116  case 'O': case 'P': return sizeof(void*);
30117  default:
30118  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30119  return 0;
30120  }
30121 }
30122 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
30123  switch (ch) {
30124  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
30125  case 'h': case 'H': return sizeof(short);
30126  case 'i': case 'I': return sizeof(int);
30127  case 'l': case 'L': return sizeof(long);
30128  #ifdef HAVE_LONG_LONG
30129  case 'q': case 'Q': return sizeof(PY_LONG_LONG);
30130  #endif
30131  case 'f': return sizeof(float) * (is_complex ? 2 : 1);
30132  case 'd': return sizeof(double) * (is_complex ? 2 : 1);
30133  case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
30134  case 'O': case 'P': return sizeof(void*);
30135  default: {
30136  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30137  return 0;
30138  }
30139  }
30140 }
30141 typedef struct { char c; short x; } __Pyx_st_short;
30142 typedef struct { char c; int x; } __Pyx_st_int;
30143 typedef struct { char c; long x; } __Pyx_st_long;
30144 typedef struct { char c; float x; } __Pyx_st_float;
30145 typedef struct { char c; double x; } __Pyx_st_double;
30146 typedef struct { char c; long double x; } __Pyx_st_longdouble;
30147 typedef struct { char c; void *x; } __Pyx_st_void_p;
30148 #ifdef HAVE_LONG_LONG
30149 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
30150 #endif
30151 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
30152  switch (ch) {
30153  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
30154  case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
30155  case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
30156  case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
30157 #ifdef HAVE_LONG_LONG
30158  case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
30159 #endif
30160  case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
30161  case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
30162  case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
30163  case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
30164  default:
30165  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30166  return 0;
30167  }
30168 }
30169 /* These are for computing the padding at the end of the struct to align
30170  on the first member of the struct. This will probably the same as above,
30171  but we don't have any guarantees.
30172  */
30173 typedef struct { short x; char c; } __Pyx_pad_short;
30174 typedef struct { int x; char c; } __Pyx_pad_int;
30175 typedef struct { long x; char c; } __Pyx_pad_long;
30176 typedef struct { float x; char c; } __Pyx_pad_float;
30177 typedef struct { double x; char c; } __Pyx_pad_double;
30178 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
30179 typedef struct { void *x; char c; } __Pyx_pad_void_p;
30180 #ifdef HAVE_LONG_LONG
30181 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
30182 #endif
30183 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
30184  switch (ch) {
30185  case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
30186  case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
30187  case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
30188  case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
30189 #ifdef HAVE_LONG_LONG
30190  case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
30191 #endif
30192  case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
30193  case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
30194  case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
30195  case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
30196  default:
30197  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30198  return 0;
30199  }
30200 }
30201 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
30202  switch (ch) {
30203  case 'c':
30204  return 'H';
30205  case 'b': case 'h': case 'i':
30206  case 'l': case 'q': case 's': case 'p':
30207  return 'I';
30208  case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
30209  return 'U';
30210  case 'f': case 'd': case 'g':
30211  return (is_complex ? 'C' : 'R');
30212  case 'O':
30213  return 'O';
30214  case 'P':
30215  return 'P';
30216  default: {
30217  __Pyx_BufFmt_RaiseUnexpectedChar(ch);
30218  return 0;
30219  }
30220  }
30221 }
30222 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
30223  if (ctx->head == NULL || ctx->head->field == &ctx->root) {
30224  const char* expected;
30225  const char* quote;
30226  if (ctx->head == NULL) {
30227  expected = "end";
30228  quote = "";
30229  } else {
30230  expected = ctx->head->field->type->name;
30231  quote = "'";
30232  }
30233  PyErr_Format(PyExc_ValueError,
30234  "Buffer dtype mismatch, expected %s%s%s but got %s",
30235  quote, expected, quote,
30236  __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
30237  } else {
30238  __Pyx_StructField* field = ctx->head->field;
30239  __Pyx_StructField* parent = (ctx->head - 1)->field;
30240  PyErr_Format(PyExc_ValueError,
30241  "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
30242  field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
30243  parent->type->name, field->name);
30244  }
30245 }
30246 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
30247  char group;
30248  size_t size, offset, arraysize = 1;
30249  if (ctx->enc_type == 0) return 0;
30250  if (ctx->head->field->type->arraysize[0]) {
30251  int i, ndim = 0;
30252  if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
30253  ctx->is_valid_array = ctx->head->field->type->ndim == 1;
30254  ndim = 1;
30255  if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
30256  PyErr_Format(PyExc_ValueError,
30257  "Expected a dimension of size %zu, got %zu",
30258  ctx->head->field->type->arraysize[0], ctx->enc_count);
30259  return -1;
30260  }
30261  }
30262  if (!ctx->is_valid_array) {
30263  PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
30264  ctx->head->field->type->ndim, ndim);
30265  return -1;
30266  }
30267  for (i = 0; i < ctx->head->field->type->ndim; i++) {
30268  arraysize *= ctx->head->field->type->arraysize[i];
30269  }
30270  ctx->is_valid_array = 0;
30271  ctx->enc_count = 1;
30272  }
30273  group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
30274  do {
30275  __Pyx_StructField* field = ctx->head->field;
30276  __Pyx_TypeInfo* type = field->type;
30277  if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
30278  size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
30279  } else {
30280  size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
30281  }
30282  if (ctx->enc_packmode == '@') {
30283  size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
30284  size_t align_mod_offset;
30285  if (align_at == 0) return -1;
30286  align_mod_offset = ctx->fmt_offset % align_at;
30287  if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
30288  if (ctx->struct_alignment == 0)
30289  ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
30290  ctx->is_complex);
30291  }
30292  if (type->size != size || type->typegroup != group) {
30293  if (type->typegroup == 'C' && type->fields != NULL) {
30294  size_t parent_offset = ctx->head->parent_offset + field->offset;
30295  ++ctx->head;
30296  ctx->head->field = type->fields;
30297  ctx->head->parent_offset = parent_offset;
30298  continue;
30299  }
30300  if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
30301  } else {
30302  __Pyx_BufFmt_RaiseExpected(ctx);
30303  return -1;
30304  }
30305  }
30306  offset = ctx->head->parent_offset + field->offset;
30307  if (ctx->fmt_offset != offset) {
30308  PyErr_Format(PyExc_ValueError,
30309  "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
30310  (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
30311  return -1;
30312  }
30313  ctx->fmt_offset += size;
30314  if (arraysize)
30315  ctx->fmt_offset += (arraysize - 1) * size;
30316  --ctx->enc_count;
30317  while (1) {
30318  if (field == &ctx->root) {
30319  ctx->head = NULL;
30320  if (ctx->enc_count != 0) {
30321  __Pyx_BufFmt_RaiseExpected(ctx);
30322  return -1;
30323  }
30324  break;
30325  }
30326  ctx->head->field = ++field;
30327  if (field->type == NULL) {
30328  --ctx->head;
30329  field = ctx->head->field;
30330  continue;
30331  } else if (field->type->typegroup == 'S') {
30332  size_t parent_offset = ctx->head->parent_offset + field->offset;
30333  if (field->type->fields->type == NULL) continue;
30334  field = field->type->fields;
30335  ++ctx->head;
30336  ctx->head->field = field;
30337  ctx->head->parent_offset = parent_offset;
30338  break;
30339  } else {
30340  break;
30341  }
30342  }
30343  } while (ctx->enc_count);
30344  ctx->enc_type = 0;
30345  ctx->is_complex = 0;
30346  return 0;
30347 }
30348 static PyObject *
30349 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
30350 {
30351  const char *ts = *tsp;
30352  int i = 0, number, ndim;
30353  ++ts;
30354  if (ctx->new_count != 1) {
30355  PyErr_SetString(PyExc_ValueError,
30356  "Cannot handle repeated arrays in format string");
30357  return NULL;
30358  }
30359  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30360  ndim = ctx->head->field->type->ndim;
30361  while (*ts && *ts != ')') {
30362  switch (*ts) {
30363  case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
30364  default: break;
30365  }
30366  number = __Pyx_BufFmt_ExpectNumber(&ts);
30367  if (number == -1) return NULL;
30368  if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
30369  return PyErr_Format(PyExc_ValueError,
30370  "Expected a dimension of size %zu, got %d",
30371  ctx->head->field->type->arraysize[i], number);
30372  if (*ts != ',' && *ts != ')')
30373  return PyErr_Format(PyExc_ValueError,
30374  "Expected a comma in format string, got '%c'", *ts);
30375  if (*ts == ',') ts++;
30376  i++;
30377  }
30378  if (i != ndim)
30379  return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
30380  ctx->head->field->type->ndim, i);
30381  if (!*ts) {
30382  PyErr_SetString(PyExc_ValueError,
30383  "Unexpected end of format string, expected ')'");
30384  return NULL;
30385  }
30386  ctx->is_valid_array = 1;
30387  ctx->new_count = 1;
30388  *tsp = ++ts;
30389  return Py_None;
30390 }
30391 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
30392  int got_Z = 0;
30393  while (1) {
30394  switch(*ts) {
30395  case 0:
30396  if (ctx->enc_type != 0 && ctx->head == NULL) {
30397  __Pyx_BufFmt_RaiseExpected(ctx);
30398  return NULL;
30399  }
30400  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30401  if (ctx->head != NULL) {
30402  __Pyx_BufFmt_RaiseExpected(ctx);
30403  return NULL;
30404  }
30405  return ts;
30406  case ' ':
30407  case '\r':
30408  case '\n':
30409  ++ts;
30410  break;
30411  case '<':
30412  if (!__Pyx_Is_Little_Endian()) {
30413  PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
30414  return NULL;
30415  }
30416  ctx->new_packmode = '=';
30417  ++ts;
30418  break;
30419  case '>':
30420  case '!':
30421  if (__Pyx_Is_Little_Endian()) {
30422  PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
30423  return NULL;
30424  }
30425  ctx->new_packmode = '=';
30426  ++ts;
30427  break;
30428  case '=':
30429  case '@':
30430  case '^':
30431  ctx->new_packmode = *ts++;
30432  break;
30433  case 'T':
30434  {
30435  const char* ts_after_sub;
30436  size_t i, struct_count = ctx->new_count;
30437  size_t struct_alignment = ctx->struct_alignment;
30438  ctx->new_count = 1;
30439  ++ts;
30440  if (*ts != '{') {
30441  PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
30442  return NULL;
30443  }
30444  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30445  ctx->enc_type = 0;
30446  ctx->enc_count = 0;
30447  ctx->struct_alignment = 0;
30448  ++ts;
30449  ts_after_sub = ts;
30450  for (i = 0; i != struct_count; ++i) {
30451  ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
30452  if (!ts_after_sub) return NULL;
30453  }
30454  ts = ts_after_sub;
30455  if (struct_alignment) ctx->struct_alignment = struct_alignment;
30456  }
30457  break;
30458  case '}':
30459  {
30460  size_t alignment = ctx->struct_alignment;
30461  ++ts;
30462  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30463  ctx->enc_type = 0;
30464  if (alignment && ctx->fmt_offset % alignment) {
30465  ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
30466  }
30467  }
30468  return ts;
30469  case 'x':
30470  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30471  ctx->fmt_offset += ctx->new_count;
30472  ctx->new_count = 1;
30473  ctx->enc_count = 0;
30474  ctx->enc_type = 0;
30475  ctx->enc_packmode = ctx->new_packmode;
30476  ++ts;
30477  break;
30478  case 'Z':
30479  got_Z = 1;
30480  ++ts;
30481  if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
30482  __Pyx_BufFmt_RaiseUnexpectedChar('Z');
30483  return NULL;
30484  }
30485  CYTHON_FALLTHROUGH;
30486  case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
30487  case 'l': case 'L': case 'q': case 'Q':
30488  case 'f': case 'd': case 'g':
30489  case 'O': case 'p':
30490  if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
30491  (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
30492  ctx->enc_count += ctx->new_count;
30493  ctx->new_count = 1;
30494  got_Z = 0;
30495  ++ts;
30496  break;
30497  }
30498  CYTHON_FALLTHROUGH;
30499  case 's':
30500  if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
30501  ctx->enc_count = ctx->new_count;
30502  ctx->enc_packmode = ctx->new_packmode;
30503  ctx->enc_type = *ts;
30504  ctx->is_complex = got_Z;
30505  ++ts;
30506  ctx->new_count = 1;
30507  got_Z = 0;
30508  break;
30509  case ':':
30510  ++ts;
30511  while(*ts != ':') ++ts;
30512  ++ts;
30513  break;
30514  case '(':
30515  if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
30516  break;
30517  default:
30518  {
30519  int number = __Pyx_BufFmt_ExpectNumber(&ts);
30520  if (number == -1) return NULL;
30521  ctx->new_count = (size_t)number;
30522  }
30523  }
30524  }
30525 }
30526 
30527 /* TypeInfoCompare */
30528  static int
30529 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
30530 {
30531  int i;
30532  if (!a || !b)
30533  return 0;
30534  if (a == b)
30535  return 1;
30536  if (a->size != b->size || a->typegroup != b->typegroup ||
30537  a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
30538  if (a->typegroup == 'H' || b->typegroup == 'H') {
30539  return a->size == b->size;
30540  } else {
30541  return 0;
30542  }
30543  }
30544  if (a->ndim) {
30545  for (i = 0; i < a->ndim; i++)
30546  if (a->arraysize[i] != b->arraysize[i])
30547  return 0;
30548  }
30549  if (a->typegroup == 'S') {
30550  if (a->flags != b->flags)
30551  return 0;
30552  if (a->fields || b->fields) {
30553  if (!(a->fields && b->fields))
30554  return 0;
30555  for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
30556  __Pyx_StructField *field_a = a->fields + i;
30557  __Pyx_StructField *field_b = b->fields + i;
30558  if (field_a->offset != field_b->offset ||
30559  !__pyx_typeinfo_cmp(field_a->type, field_b->type))
30560  return 0;
30561  }
30562  return !a->fields[i].type && !b->fields[i].type;
30563  }
30564  }
30565  return 1;
30566 }
30567 
30568 /* MemviewSliceValidateAndInit */
30569  static int
30570 __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
30571 {
30572  if (buf->shape[dim] <= 1)
30573  return 1;
30574  if (buf->strides) {
30575  if (spec & __Pyx_MEMVIEW_CONTIG) {
30576  if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
30577  if (unlikely(buf->strides[dim] != sizeof(void *))) {
30578  PyErr_Format(PyExc_ValueError,
30579  "Buffer is not indirectly contiguous "
30580  "in dimension %d.", dim);
30581  goto fail;
30582  }
30583  } else if (unlikely(buf->strides[dim] != buf->itemsize)) {
30584  PyErr_SetString(PyExc_ValueError,
30585  "Buffer and memoryview are not contiguous "
30586  "in the same dimension.");
30587  goto fail;
30588  }
30589  }
30590  if (spec & __Pyx_MEMVIEW_FOLLOW) {
30591  Py_ssize_t stride = buf->strides[dim];
30592  if (stride < 0)
30593  stride = -stride;
30594  if (unlikely(stride < buf->itemsize)) {
30595  PyErr_SetString(PyExc_ValueError,
30596  "Buffer and memoryview are not contiguous "
30597  "in the same dimension.");
30598  goto fail;
30599  }
30600  }
30601  } else {
30602  if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
30603  PyErr_Format(PyExc_ValueError,
30604  "C-contiguous buffer is not contiguous in "
30605  "dimension %d", dim);
30606  goto fail;
30607  } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
30608  PyErr_Format(PyExc_ValueError,
30609  "C-contiguous buffer is not indirect in "
30610  "dimension %d", dim);
30611  goto fail;
30612  } else if (unlikely(buf->suboffsets)) {
30613  PyErr_SetString(PyExc_ValueError,
30614  "Buffer exposes suboffsets but no strides");
30615  goto fail;
30616  }
30617  }
30618  return 1;
30619 fail:
30620  return 0;
30621 }
30622 static int
30623 __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
30624 {
30625  if (spec & __Pyx_MEMVIEW_DIRECT) {
30626  if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
30627  PyErr_Format(PyExc_ValueError,
30628  "Buffer not compatible with direct access "
30629  "in dimension %d.", dim);
30630  goto fail;
30631  }
30632  }
30633  if (spec & __Pyx_MEMVIEW_PTR) {
30634  if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
30635  PyErr_Format(PyExc_ValueError,
30636  "Buffer is not indirectly accessible "
30637  "in dimension %d.", dim);
30638  goto fail;
30639  }
30640  }
30641  return 1;
30642 fail:
30643  return 0;
30644 }
30645 static int
30646 __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
30647 {
30648  int i;
30649  if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
30650  Py_ssize_t stride = 1;
30651  for (i = 0; i < ndim; i++) {
30652  if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
30653  PyErr_SetString(PyExc_ValueError,
30654  "Buffer not fortran contiguous.");
30655  goto fail;
30656  }
30657  stride = stride * buf->shape[i];
30658  }
30659  } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
30660  Py_ssize_t stride = 1;
30661  for (i = ndim - 1; i >- 1; i--) {
30662  if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
30663  PyErr_SetString(PyExc_ValueError,
30664  "Buffer not C contiguous.");
30665  goto fail;
30666  }
30667  stride = stride * buf->shape[i];
30668  }
30669  }
30670  return 1;
30671 fail:
30672  return 0;
30673 }
30674 static int __Pyx_ValidateAndInit_memviewslice(
30675  int *axes_specs,
30676  int c_or_f_flag,
30677  int buf_flags,
30678  int ndim,
30679  __Pyx_TypeInfo *dtype,
30680  __Pyx_BufFmt_StackElem stack[],
30681  __Pyx_memviewslice *memviewslice,
30682  PyObject *original_obj)
30683 {
30684  struct __pyx_memoryview_obj *memview, *new_memview;
30685  __Pyx_RefNannyDeclarations
30686  Py_buffer *buf;
30687  int i, spec = 0, retval = -1;
30688  __Pyx_BufFmt_Context ctx;
30689  int from_memoryview = __pyx_memoryview_check(original_obj);
30690  __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
30691  if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
30692  original_obj)->typeinfo)) {
30693  memview = (struct __pyx_memoryview_obj *) original_obj;
30694  new_memview = NULL;
30695  } else {
30696  memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
30697  original_obj, buf_flags, 0, dtype);
30698  new_memview = memview;
30699  if (unlikely(!memview))
30700  goto fail;
30701  }
30702  buf = &memview->view;
30703  if (unlikely(buf->ndim != ndim)) {
30704  PyErr_Format(PyExc_ValueError,
30705  "Buffer has wrong number of dimensions (expected %d, got %d)",
30706  ndim, buf->ndim);
30707  goto fail;
30708  }
30709  if (new_memview) {
30710  __Pyx_BufFmt_Init(&ctx, stack, dtype);
30711  if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail;
30712  }
30713  if (unlikely((unsigned) buf->itemsize != dtype->size)) {
30714  PyErr_Format(PyExc_ValueError,
30715  "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
30716  "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
30717  buf->itemsize,
30718  (buf->itemsize > 1) ? "s" : "",
30719  dtype->name,
30720  dtype->size,
30721  (dtype->size > 1) ? "s" : "");
30722  goto fail;
30723  }
30724  if (buf->len > 0) {
30725  for (i = 0; i < ndim; i++) {
30726  spec = axes_specs[i];
30727  if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
30728  goto fail;
30729  if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
30730  goto fail;
30731  }
30732  if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
30733  goto fail;
30734  }
30735  if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
30736  new_memview != NULL) == -1)) {
30737  goto fail;
30738  }
30739  retval = 0;
30740  goto no_fail;
30741 fail:
30742  Py_XDECREF(new_memview);
30743  retval = -1;
30744 no_fail:
30745  __Pyx_RefNannyFinishContext();
30746  return retval;
30747 }
30748 
30749 /* ObjectToMemviewSlice */
30750  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__float(PyObject *obj, int writable_flag) {
30751  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30752  __Pyx_BufFmt_StackElem stack[1];
30753  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
30754  int retcode;
30755  if (obj == Py_None) {
30756  result.memview = (struct __pyx_memoryview_obj *) Py_None;
30757  return result;
30758  }
30759  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
30760  (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
30761  &__Pyx_TypeInfo_float, stack,
30762  &result, obj);
30763  if (unlikely(retcode == -1))
30764  goto __pyx_fail;
30765  return result;
30766 __pyx_fail:
30767  result.memview = NULL;
30768  result.data = NULL;
30769  return result;
30770 }
30771 
30772 /* CIntFromPyVerify */
30773  #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
30774  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
30775 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
30776  __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
30777 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
30778  {\
30779  func_type value = func_value;\
30780  if (sizeof(target_type) < sizeof(func_type)) {\
30781  if (unlikely(value != (func_type) (target_type) value)) {\
30782  func_type zero = 0;\
30783  if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
30784  return (target_type) -1;\
30785  if (is_unsigned && unlikely(value < zero))\
30786  goto raise_neg_overflow;\
30787  else\
30788  goto raise_overflow;\
30789  }\
30790  }\
30791  return (target_type) value;\
30792  }
30793 
30794 /* ObjectToMemviewSlice */
30795  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dcd__double(PyObject *obj, int writable_flag) {
30796  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30797  __Pyx_BufFmt_StackElem stack[1];
30798  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW) };
30799  int retcode;
30800  if (obj == Py_None) {
30801  result.memview = (struct __pyx_memoryview_obj *) Py_None;
30802  return result;
30803  }
30804  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_F_CONTIG,
30805  (PyBUF_F_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
30806  &__Pyx_TypeInfo_double, stack,
30807  &result, obj);
30808  if (unlikely(retcode == -1))
30809  goto __pyx_fail;
30810  return result;
30811 __pyx_fail:
30812  result.memview = NULL;
30813  result.data = NULL;
30814  return result;
30815 }
30816 
30817 /* ObjectToMemviewSlice */
30818  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj, int writable_flag) {
30819  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30820  __Pyx_BufFmt_StackElem stack[1];
30821  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
30822  int retcode;
30823  if (obj == Py_None) {
30824  result.memview = (struct __pyx_memoryview_obj *) Py_None;
30825  return result;
30826  }
30827  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
30828  PyBUF_RECORDS_RO | writable_flag, 1,
30829  &__Pyx_TypeInfo_float, stack,
30830  &result, obj);
30831  if (unlikely(retcode == -1))
30832  goto __pyx_fail;
30833  return result;
30834 __pyx_fail:
30835  result.memview = NULL;
30836  result.data = NULL;
30837  return result;
30838 }
30839 
30840 /* ObjectToMemviewSlice */
30841  static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj, int writable_flag) {
30842  __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
30843  __Pyx_BufFmt_StackElem stack[1];
30844  int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
30845  int retcode;
30846  if (obj == Py_None) {
30847  result.memview = (struct __pyx_memoryview_obj *) Py_None;
30848  return result;
30849  }
30850  retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
30851  PyBUF_RECORDS_RO | writable_flag, 1,
30852  &__Pyx_TypeInfo_double, stack,
30853  &result, obj);
30854  if (unlikely(retcode == -1))
30855  goto __pyx_fail;
30856  return result;
30857 __pyx_fail:
30858  result.memview = NULL;
30859  result.data = NULL;
30860  return result;
30861 }
30862 
30863 /* MemviewSliceCopyTemplate */
30864  static __Pyx_memviewslice
30865 __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
30866  const char *mode, int ndim,
30867  size_t sizeof_dtype, int contig_flag,
30868  int dtype_is_object)
30869 {
30870  __Pyx_RefNannyDeclarations
30871  int i;
30872  __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
30873  struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
30874  Py_buffer *buf = &from_memview->view;
30875  PyObject *shape_tuple = NULL;
30876  PyObject *temp_int = NULL;
30877  struct __pyx_array_obj *array_obj = NULL;
30878  struct __pyx_memoryview_obj *memview_obj = NULL;
30879  __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
30880  for (i = 0; i < ndim; i++) {
30881  if (unlikely(from_mvs->suboffsets[i] >= 0)) {
30882  PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
30883  "indirect dimensions (axis %d)", i);
30884  goto fail;
30885  }
30886  }
30887  shape_tuple = PyTuple_New(ndim);
30888  if (unlikely(!shape_tuple)) {
30889  goto fail;
30890  }
30891  __Pyx_GOTREF(shape_tuple);
30892  for(i = 0; i < ndim; i++) {
30893  temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
30894  if(unlikely(!temp_int)) {
30895  goto fail;
30896  } else {
30897  PyTuple_SET_ITEM(shape_tuple, i, temp_int);
30898  temp_int = NULL;
30899  }
30900  }
30901  array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
30902  if (unlikely(!array_obj)) {
30903  goto fail;
30904  }
30905  __Pyx_GOTREF(array_obj);
30906  memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
30907  (PyObject *) array_obj, contig_flag,
30908  dtype_is_object,
30909  from_mvs->memview->typeinfo);
30910  if (unlikely(!memview_obj))
30911  goto fail;
30912  if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
30913  goto fail;
30914  if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
30915  dtype_is_object) < 0))
30916  goto fail;
30917  goto no_fail;
30918 fail:
30919  __Pyx_XDECREF(new_mvs.memview);
30920  new_mvs.memview = NULL;
30921  new_mvs.data = NULL;
30922 no_fail:
30923  __Pyx_XDECREF(shape_tuple);
30924  __Pyx_XDECREF(temp_int);
30925  __Pyx_XDECREF(array_obj);
30926  __Pyx_RefNannyFinishContext();
30927  return new_mvs;
30928 }
30929 
30930 /* CIntToPy */
30931  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
30932 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30933 #pragma GCC diagnostic push
30934 #pragma GCC diagnostic ignored "-Wconversion"
30935 #endif
30936  const long neg_one = (long) -1, const_zero = (long) 0;
30937 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30938 #pragma GCC diagnostic pop
30939 #endif
30940  const int is_unsigned = neg_one > const_zero;
30941  if (is_unsigned) {
30942  if (sizeof(long) < sizeof(long)) {
30943  return PyInt_FromLong((long) value);
30944  } else if (sizeof(long) <= sizeof(unsigned long)) {
30945  return PyLong_FromUnsignedLong((unsigned long) value);
30946 #ifdef HAVE_LONG_LONG
30947  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
30948  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
30949 #endif
30950  }
30951  } else {
30952  if (sizeof(long) <= sizeof(long)) {
30953  return PyInt_FromLong((long) value);
30954 #ifdef HAVE_LONG_LONG
30955  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
30956  return PyLong_FromLongLong((PY_LONG_LONG) value);
30957 #endif
30958  }
30959  }
30960  {
30961  int one = 1; int little = (int)*(unsigned char *)&one;
30962  unsigned char *bytes = (unsigned char *)&value;
30963  return _PyLong_FromByteArray(bytes, sizeof(long),
30964  little, !is_unsigned);
30965  }
30966 }
30967 
30968 /* CIntFromPy */
30969  static CYTHON_INLINE LongIndexType __Pyx_PyInt_As_LongIndexType(PyObject *x) {
30970 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30971 #pragma GCC diagnostic push
30972 #pragma GCC diagnostic ignored "-Wconversion"
30973 #endif
30974  const LongIndexType neg_one = (LongIndexType) -1, const_zero = (LongIndexType) 0;
30975 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
30976 #pragma GCC diagnostic pop
30977 #endif
30978  const int is_unsigned = neg_one > const_zero;
30979 #if PY_MAJOR_VERSION < 3
30980  if (likely(PyInt_Check(x))) {
30981  if (sizeof(LongIndexType) < sizeof(long)) {
30982  __PYX_VERIFY_RETURN_INT(LongIndexType, long, PyInt_AS_LONG(x))
30983  } else {
30984  long val = PyInt_AS_LONG(x);
30985  if (is_unsigned && unlikely(val < 0)) {
30986  goto raise_neg_overflow;
30987  }
30988  return (LongIndexType) val;
30989  }
30990  } else
30991 #endif
30992  if (likely(PyLong_Check(x))) {
30993  if (is_unsigned) {
30994 #if CYTHON_USE_PYLONG_INTERNALS
30995  const digit* digits = ((PyLongObject*)x)->ob_digit;
30996  switch (Py_SIZE(x)) {
30997  case 0: return (LongIndexType) 0;
30998  case 1: __PYX_VERIFY_RETURN_INT(LongIndexType, digit, digits[0])
30999  case 2:
31000  if (8 * sizeof(LongIndexType) > 1 * PyLong_SHIFT) {
31001  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31002  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31003  } else if (8 * sizeof(LongIndexType) >= 2 * PyLong_SHIFT) {
31004  return (LongIndexType) (((((LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0]));
31005  }
31006  }
31007  break;
31008  case 3:
31009  if (8 * sizeof(LongIndexType) > 2 * PyLong_SHIFT) {
31010  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31011  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31012  } else if (8 * sizeof(LongIndexType) >= 3 * PyLong_SHIFT) {
31013  return (LongIndexType) (((((((LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0]));
31014  }
31015  }
31016  break;
31017  case 4:
31018  if (8 * sizeof(LongIndexType) > 3 * PyLong_SHIFT) {
31019  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31020  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31021  } else if (8 * sizeof(LongIndexType) >= 4 * PyLong_SHIFT) {
31022  return (LongIndexType) (((((((((LongIndexType)digits[3]) << PyLong_SHIFT) | (LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0]));
31023  }
31024  }
31025  break;
31026  }
31027 #endif
31028 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31029  if (unlikely(Py_SIZE(x) < 0)) {
31030  goto raise_neg_overflow;
31031  }
31032 #else
31033  {
31034  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31035  if (unlikely(result < 0))
31036  return (LongIndexType) -1;
31037  if (unlikely(result == 1))
31038  goto raise_neg_overflow;
31039  }
31040 #endif
31041  if (sizeof(LongIndexType) <= sizeof(unsigned long)) {
31042  __PYX_VERIFY_RETURN_INT_EXC(LongIndexType, unsigned long, PyLong_AsUnsignedLong(x))
31043 #ifdef HAVE_LONG_LONG
31044  } else if (sizeof(LongIndexType) <= sizeof(unsigned PY_LONG_LONG)) {
31045  __PYX_VERIFY_RETURN_INT_EXC(LongIndexType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31046 #endif
31047  }
31048  } else {
31049 #if CYTHON_USE_PYLONG_INTERNALS
31050  const digit* digits = ((PyLongObject*)x)->ob_digit;
31051  switch (Py_SIZE(x)) {
31052  case 0: return (LongIndexType) 0;
31053  case -1: __PYX_VERIFY_RETURN_INT(LongIndexType, sdigit, (sdigit) (-(sdigit)digits[0]))
31054  case 1: __PYX_VERIFY_RETURN_INT(LongIndexType, digit, +digits[0])
31055  case -2:
31056  if (8 * sizeof(LongIndexType) - 1 > 1 * PyLong_SHIFT) {
31057  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31058  __PYX_VERIFY_RETURN_INT(LongIndexType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31059  } else if (8 * sizeof(LongIndexType) - 1 > 2 * PyLong_SHIFT) {
31060  return (LongIndexType) (((LongIndexType)-1)*(((((LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31061  }
31062  }
31063  break;
31064  case 2:
31065  if (8 * sizeof(LongIndexType) > 1 * PyLong_SHIFT) {
31066  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31067  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31068  } else if (8 * sizeof(LongIndexType) - 1 > 2 * PyLong_SHIFT) {
31069  return (LongIndexType) ((((((LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31070  }
31071  }
31072  break;
31073  case -3:
31074  if (8 * sizeof(LongIndexType) - 1 > 2 * PyLong_SHIFT) {
31075  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31076  __PYX_VERIFY_RETURN_INT(LongIndexType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31077  } else if (8 * sizeof(LongIndexType) - 1 > 3 * PyLong_SHIFT) {
31078  return (LongIndexType) (((LongIndexType)-1)*(((((((LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31079  }
31080  }
31081  break;
31082  case 3:
31083  if (8 * sizeof(LongIndexType) > 2 * PyLong_SHIFT) {
31084  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31085  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31086  } else if (8 * sizeof(LongIndexType) - 1 > 3 * PyLong_SHIFT) {
31087  return (LongIndexType) ((((((((LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31088  }
31089  }
31090  break;
31091  case -4:
31092  if (8 * sizeof(LongIndexType) - 1 > 3 * PyLong_SHIFT) {
31093  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31094  __PYX_VERIFY_RETURN_INT(LongIndexType, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31095  } else if (8 * sizeof(LongIndexType) - 1 > 4 * PyLong_SHIFT) {
31096  return (LongIndexType) (((LongIndexType)-1)*(((((((((LongIndexType)digits[3]) << PyLong_SHIFT) | (LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31097  }
31098  }
31099  break;
31100  case 4:
31101  if (8 * sizeof(LongIndexType) > 3 * PyLong_SHIFT) {
31102  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31103  __PYX_VERIFY_RETURN_INT(LongIndexType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31104  } else if (8 * sizeof(LongIndexType) - 1 > 4 * PyLong_SHIFT) {
31105  return (LongIndexType) ((((((((((LongIndexType)digits[3]) << PyLong_SHIFT) | (LongIndexType)digits[2]) << PyLong_SHIFT) | (LongIndexType)digits[1]) << PyLong_SHIFT) | (LongIndexType)digits[0])));
31106  }
31107  }
31108  break;
31109  }
31110 #endif
31111  if (sizeof(LongIndexType) <= sizeof(long)) {
31112  __PYX_VERIFY_RETURN_INT_EXC(LongIndexType, long, PyLong_AsLong(x))
31113 #ifdef HAVE_LONG_LONG
31114  } else if (sizeof(LongIndexType) <= sizeof(PY_LONG_LONG)) {
31115  __PYX_VERIFY_RETURN_INT_EXC(LongIndexType, PY_LONG_LONG, PyLong_AsLongLong(x))
31116 #endif
31117  }
31118  }
31119  {
31120 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31121  PyErr_SetString(PyExc_RuntimeError,
31122  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31123 #else
31124  LongIndexType val;
31125  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31126  #if PY_MAJOR_VERSION < 3
31127  if (likely(v) && !PyLong_Check(v)) {
31128  PyObject *tmp = v;
31129  v = PyNumber_Long(tmp);
31130  Py_DECREF(tmp);
31131  }
31132  #endif
31133  if (likely(v)) {
31134  int one = 1; int is_little = (int)*(unsigned char *)&one;
31135  unsigned char *bytes = (unsigned char *)&val;
31136  int ret = _PyLong_AsByteArray((PyLongObject *)v,
31137  bytes, sizeof(val),
31138  is_little, !is_unsigned);
31139  Py_DECREF(v);
31140  if (likely(!ret))
31141  return val;
31142  }
31143 #endif
31144  return (LongIndexType) -1;
31145  }
31146  } else {
31147  LongIndexType val;
31148  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31149  if (!tmp) return (LongIndexType) -1;
31150  val = __Pyx_PyInt_As_LongIndexType(tmp);
31151  Py_DECREF(tmp);
31152  return val;
31153  }
31154 raise_overflow:
31155  PyErr_SetString(PyExc_OverflowError,
31156  "value too large to convert to LongIndexType");
31157  return (LongIndexType) -1;
31158 raise_neg_overflow:
31159  PyErr_SetString(PyExc_OverflowError,
31160  "can't convert negative value to LongIndexType");
31161  return (LongIndexType) -1;
31162 }
31163 
31164 /* CIntFromPy */
31165  static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
31166 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31167 #pragma GCC diagnostic push
31168 #pragma GCC diagnostic ignored "-Wconversion"
31169 #endif
31170  const int neg_one = (int) -1, const_zero = (int) 0;
31171 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31172 #pragma GCC diagnostic pop
31173 #endif
31174  const int is_unsigned = neg_one > const_zero;
31175 #if PY_MAJOR_VERSION < 3
31176  if (likely(PyInt_Check(x))) {
31177  if (sizeof(int) < sizeof(long)) {
31178  __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
31179  } else {
31180  long val = PyInt_AS_LONG(x);
31181  if (is_unsigned && unlikely(val < 0)) {
31182  goto raise_neg_overflow;
31183  }
31184  return (int) val;
31185  }
31186  } else
31187 #endif
31188  if (likely(PyLong_Check(x))) {
31189  if (is_unsigned) {
31190 #if CYTHON_USE_PYLONG_INTERNALS
31191  const digit* digits = ((PyLongObject*)x)->ob_digit;
31192  switch (Py_SIZE(x)) {
31193  case 0: return (int) 0;
31194  case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
31195  case 2:
31196  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
31197  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31198  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31199  } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
31200  return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
31201  }
31202  }
31203  break;
31204  case 3:
31205  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
31206  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31207  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31208  } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
31209  return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
31210  }
31211  }
31212  break;
31213  case 4:
31214  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
31215  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31216  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31217  } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
31218  return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
31219  }
31220  }
31221  break;
31222  }
31223 #endif
31224 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31225  if (unlikely(Py_SIZE(x) < 0)) {
31226  goto raise_neg_overflow;
31227  }
31228 #else
31229  {
31230  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31231  if (unlikely(result < 0))
31232  return (int) -1;
31233  if (unlikely(result == 1))
31234  goto raise_neg_overflow;
31235  }
31236 #endif
31237  if (sizeof(int) <= sizeof(unsigned long)) {
31238  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
31239 #ifdef HAVE_LONG_LONG
31240  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
31241  __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31242 #endif
31243  }
31244  } else {
31245 #if CYTHON_USE_PYLONG_INTERNALS
31246  const digit* digits = ((PyLongObject*)x)->ob_digit;
31247  switch (Py_SIZE(x)) {
31248  case 0: return (int) 0;
31249  case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
31250  case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
31251  case -2:
31252  if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
31253  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31254  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31255  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
31256  return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31257  }
31258  }
31259  break;
31260  case 2:
31261  if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
31262  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31263  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31264  } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
31265  return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31266  }
31267  }
31268  break;
31269  case -3:
31270  if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
31271  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31272  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31273  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
31274  return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31275  }
31276  }
31277  break;
31278  case 3:
31279  if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
31280  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31281  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31282  } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
31283  return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31284  }
31285  }
31286  break;
31287  case -4:
31288  if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
31289  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31290  __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31291  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
31292  return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31293  }
31294  }
31295  break;
31296  case 4:
31297  if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
31298  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31299  __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31300  } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
31301  return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
31302  }
31303  }
31304  break;
31305  }
31306 #endif
31307  if (sizeof(int) <= sizeof(long)) {
31308  __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
31309 #ifdef HAVE_LONG_LONG
31310  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
31311  __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
31312 #endif
31313  }
31314  }
31315  {
31316 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31317  PyErr_SetString(PyExc_RuntimeError,
31318  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31319 #else
31320  int val;
31321  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31322  #if PY_MAJOR_VERSION < 3
31323  if (likely(v) && !PyLong_Check(v)) {
31324  PyObject *tmp = v;
31325  v = PyNumber_Long(tmp);
31326  Py_DECREF(tmp);
31327  }
31328  #endif
31329  if (likely(v)) {
31330  int one = 1; int is_little = (int)*(unsigned char *)&one;
31331  unsigned char *bytes = (unsigned char *)&val;
31332  int ret = _PyLong_AsByteArray((PyLongObject *)v,
31333  bytes, sizeof(val),
31334  is_little, !is_unsigned);
31335  Py_DECREF(v);
31336  if (likely(!ret))
31337  return val;
31338  }
31339 #endif
31340  return (int) -1;
31341  }
31342  } else {
31343  int val;
31344  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31345  if (!tmp) return (int) -1;
31346  val = __Pyx_PyInt_As_int(tmp);
31347  Py_DECREF(tmp);
31348  return val;
31349  }
31350 raise_overflow:
31351  PyErr_SetString(PyExc_OverflowError,
31352  "value too large to convert to int");
31353  return (int) -1;
31354 raise_neg_overflow:
31355  PyErr_SetString(PyExc_OverflowError,
31356  "can't convert negative value to int");
31357  return (int) -1;
31358 }
31359 
31360 /* CIntToPy */
31361  static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
31362 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31363 #pragma GCC diagnostic push
31364 #pragma GCC diagnostic ignored "-Wconversion"
31365 #endif
31366  const int neg_one = (int) -1, const_zero = (int) 0;
31367 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31368 #pragma GCC diagnostic pop
31369 #endif
31370  const int is_unsigned = neg_one > const_zero;
31371  if (is_unsigned) {
31372  if (sizeof(int) < sizeof(long)) {
31373  return PyInt_FromLong((long) value);
31374  } else if (sizeof(int) <= sizeof(unsigned long)) {
31375  return PyLong_FromUnsignedLong((unsigned long) value);
31376 #ifdef HAVE_LONG_LONG
31377  } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
31378  return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
31379 #endif
31380  }
31381  } else {
31382  if (sizeof(int) <= sizeof(long)) {
31383  return PyInt_FromLong((long) value);
31384 #ifdef HAVE_LONG_LONG
31385  } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
31386  return PyLong_FromLongLong((PY_LONG_LONG) value);
31387 #endif
31388  }
31389  }
31390  {
31391  int one = 1; int little = (int)*(unsigned char *)&one;
31392  unsigned char *bytes = (unsigned char *)&value;
31393  return _PyLong_FromByteArray(bytes, sizeof(int),
31394  little, !is_unsigned);
31395  }
31396 }
31397 
31398 /* CIntFromPy */
31399  static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
31400 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31401 #pragma GCC diagnostic push
31402 #pragma GCC diagnostic ignored "-Wconversion"
31403 #endif
31404  const long neg_one = (long) -1, const_zero = (long) 0;
31405 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31406 #pragma GCC diagnostic pop
31407 #endif
31408  const int is_unsigned = neg_one > const_zero;
31409 #if PY_MAJOR_VERSION < 3
31410  if (likely(PyInt_Check(x))) {
31411  if (sizeof(long) < sizeof(long)) {
31412  __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
31413  } else {
31414  long val = PyInt_AS_LONG(x);
31415  if (is_unsigned && unlikely(val < 0)) {
31416  goto raise_neg_overflow;
31417  }
31418  return (long) val;
31419  }
31420  } else
31421 #endif
31422  if (likely(PyLong_Check(x))) {
31423  if (is_unsigned) {
31424 #if CYTHON_USE_PYLONG_INTERNALS
31425  const digit* digits = ((PyLongObject*)x)->ob_digit;
31426  switch (Py_SIZE(x)) {
31427  case 0: return (long) 0;
31428  case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
31429  case 2:
31430  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
31431  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31432  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31433  } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
31434  return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
31435  }
31436  }
31437  break;
31438  case 3:
31439  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
31440  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31441  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31442  } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
31443  return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
31444  }
31445  }
31446  break;
31447  case 4:
31448  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
31449  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31450  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31451  } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
31452  return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
31453  }
31454  }
31455  break;
31456  }
31457 #endif
31458 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31459  if (unlikely(Py_SIZE(x) < 0)) {
31460  goto raise_neg_overflow;
31461  }
31462 #else
31463  {
31464  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31465  if (unlikely(result < 0))
31466  return (long) -1;
31467  if (unlikely(result == 1))
31468  goto raise_neg_overflow;
31469  }
31470 #endif
31471  if (sizeof(long) <= sizeof(unsigned long)) {
31472  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
31473 #ifdef HAVE_LONG_LONG
31474  } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
31475  __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31476 #endif
31477  }
31478  } else {
31479 #if CYTHON_USE_PYLONG_INTERNALS
31480  const digit* digits = ((PyLongObject*)x)->ob_digit;
31481  switch (Py_SIZE(x)) {
31482  case 0: return (long) 0;
31483  case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
31484  case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
31485  case -2:
31486  if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
31487  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31488  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31489  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
31490  return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31491  }
31492  }
31493  break;
31494  case 2:
31495  if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
31496  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31497  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31498  } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
31499  return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31500  }
31501  }
31502  break;
31503  case -3:
31504  if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
31505  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31506  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31507  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
31508  return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31509  }
31510  }
31511  break;
31512  case 3:
31513  if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
31514  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31515  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31516  } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
31517  return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31518  }
31519  }
31520  break;
31521  case -4:
31522  if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
31523  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31524  __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31525  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
31526  return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31527  }
31528  }
31529  break;
31530  case 4:
31531  if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
31532  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31533  __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31534  } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
31535  return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
31536  }
31537  }
31538  break;
31539  }
31540 #endif
31541  if (sizeof(long) <= sizeof(long)) {
31542  __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
31543 #ifdef HAVE_LONG_LONG
31544  } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
31545  __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
31546 #endif
31547  }
31548  }
31549  {
31550 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31551  PyErr_SetString(PyExc_RuntimeError,
31552  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31553 #else
31554  long val;
31555  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31556  #if PY_MAJOR_VERSION < 3
31557  if (likely(v) && !PyLong_Check(v)) {
31558  PyObject *tmp = v;
31559  v = PyNumber_Long(tmp);
31560  Py_DECREF(tmp);
31561  }
31562  #endif
31563  if (likely(v)) {
31564  int one = 1; int is_little = (int)*(unsigned char *)&one;
31565  unsigned char *bytes = (unsigned char *)&val;
31566  int ret = _PyLong_AsByteArray((PyLongObject *)v,
31567  bytes, sizeof(val),
31568  is_little, !is_unsigned);
31569  Py_DECREF(v);
31570  if (likely(!ret))
31571  return val;
31572  }
31573 #endif
31574  return (long) -1;
31575  }
31576  } else {
31577  long val;
31578  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31579  if (!tmp) return (long) -1;
31580  val = __Pyx_PyInt_As_long(tmp);
31581  Py_DECREF(tmp);
31582  return val;
31583  }
31584 raise_overflow:
31585  PyErr_SetString(PyExc_OverflowError,
31586  "value too large to convert to long");
31587  return (long) -1;
31588 raise_neg_overflow:
31589  PyErr_SetString(PyExc_OverflowError,
31590  "can't convert negative value to long");
31591  return (long) -1;
31592 }
31593 
31594 /* CIntFromPy */
31595  static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
31596 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31597 #pragma GCC diagnostic push
31598 #pragma GCC diagnostic ignored "-Wconversion"
31599 #endif
31600  const char neg_one = (char) -1, const_zero = (char) 0;
31601 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
31602 #pragma GCC diagnostic pop
31603 #endif
31604  const int is_unsigned = neg_one > const_zero;
31605 #if PY_MAJOR_VERSION < 3
31606  if (likely(PyInt_Check(x))) {
31607  if (sizeof(char) < sizeof(long)) {
31608  __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
31609  } else {
31610  long val = PyInt_AS_LONG(x);
31611  if (is_unsigned && unlikely(val < 0)) {
31612  goto raise_neg_overflow;
31613  }
31614  return (char) val;
31615  }
31616  } else
31617 #endif
31618  if (likely(PyLong_Check(x))) {
31619  if (is_unsigned) {
31620 #if CYTHON_USE_PYLONG_INTERNALS
31621  const digit* digits = ((PyLongObject*)x)->ob_digit;
31622  switch (Py_SIZE(x)) {
31623  case 0: return (char) 0;
31624  case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
31625  case 2:
31626  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
31627  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31628  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31629  } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
31630  return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
31631  }
31632  }
31633  break;
31634  case 3:
31635  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
31636  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31637  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31638  } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
31639  return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
31640  }
31641  }
31642  break;
31643  case 4:
31644  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
31645  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31646  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31647  } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
31648  return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
31649  }
31650  }
31651  break;
31652  }
31653 #endif
31654 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
31655  if (unlikely(Py_SIZE(x) < 0)) {
31656  goto raise_neg_overflow;
31657  }
31658 #else
31659  {
31660  int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
31661  if (unlikely(result < 0))
31662  return (char) -1;
31663  if (unlikely(result == 1))
31664  goto raise_neg_overflow;
31665  }
31666 #endif
31667  if (sizeof(char) <= sizeof(unsigned long)) {
31668  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
31669 #ifdef HAVE_LONG_LONG
31670  } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
31671  __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
31672 #endif
31673  }
31674  } else {
31675 #if CYTHON_USE_PYLONG_INTERNALS
31676  const digit* digits = ((PyLongObject*)x)->ob_digit;
31677  switch (Py_SIZE(x)) {
31678  case 0: return (char) 0;
31679  case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
31680  case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
31681  case -2:
31682  if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
31683  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31684  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31685  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
31686  return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31687  }
31688  }
31689  break;
31690  case 2:
31691  if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
31692  if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
31693  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31694  } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
31695  return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31696  }
31697  }
31698  break;
31699  case -3:
31700  if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
31701  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31702  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31703  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
31704  return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31705  }
31706  }
31707  break;
31708  case 3:
31709  if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
31710  if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
31711  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31712  } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
31713  return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31714  }
31715  }
31716  break;
31717  case -4:
31718  if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
31719  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31720  __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31721  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
31722  return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31723  }
31724  }
31725  break;
31726  case 4:
31727  if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
31728  if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
31729  __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
31730  } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
31731  return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
31732  }
31733  }
31734  break;
31735  }
31736 #endif
31737  if (sizeof(char) <= sizeof(long)) {
31738  __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
31739 #ifdef HAVE_LONG_LONG
31740  } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
31741  __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
31742 #endif
31743  }
31744  }
31745  {
31746 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
31747  PyErr_SetString(PyExc_RuntimeError,
31748  "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
31749 #else
31750  char val;
31751  PyObject *v = __Pyx_PyNumber_IntOrLong(x);
31752  #if PY_MAJOR_VERSION < 3
31753  if (likely(v) && !PyLong_Check(v)) {
31754  PyObject *tmp = v;
31755  v = PyNumber_Long(tmp);
31756  Py_DECREF(tmp);
31757  }
31758  #endif
31759  if (likely(v)) {
31760  int one = 1; int is_little = (int)*(unsigned char *)&one;
31761  unsigned char *bytes = (unsigned char *)&val;
31762  int ret = _PyLong_AsByteArray((PyLongObject *)v,
31763  bytes, sizeof(val),
31764  is_little, !is_unsigned);
31765  Py_DECREF(v);
31766  if (likely(!ret))
31767  return val;
31768  }
31769 #endif
31770  return (char) -1;
31771  }
31772  } else {
31773  char val;
31774  PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
31775  if (!tmp) return (char) -1;
31776  val = __Pyx_PyInt_As_char(tmp);
31777  Py_DECREF(tmp);
31778  return val;
31779  }
31780 raise_overflow:
31781  PyErr_SetString(PyExc_OverflowError,
31782  "value too large to convert to char");
31783  return (char) -1;
31784 raise_neg_overflow:
31785  PyErr_SetString(PyExc_OverflowError,
31786  "can't convert negative value to char");
31787  return (char) -1;
31788 }
31789 
31790 /* CheckBinaryVersion */
31791  static int __Pyx_check_binary_version(void) {
31792  char ctversion[5];
31793  int same=1, i, found_dot;
31794  const char* rt_from_call = Py_GetVersion();
31795  PyOS_snprintf(ctversion, 5, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
31796  found_dot = 0;
31797  for (i = 0; i < 4; i++) {
31798  if (!ctversion[i]) {
31799  same = (rt_from_call[i] < '0' || rt_from_call[i] > '9');
31800  break;
31801  }
31802  if (rt_from_call[i] != ctversion[i]) {
31803  same = 0;
31804  break;
31805  }
31806  }
31807  if (!same) {
31808  char rtversion[5] = {'\0'};
31809  char message[200];
31810  for (i=0; i<4; ++i) {
31811  if (rt_from_call[i] == '.') {
31812  if (found_dot) break;
31813  found_dot = 1;
31814  } else if (rt_from_call[i] < '0' || rt_from_call[i] > '9') {
31815  break;
31816  }
31817  rtversion[i] = rt_from_call[i];
31818  }
31819  PyOS_snprintf(message, sizeof(message),
31820  "compiletime version %s of module '%.100s' "
31821  "does not match runtime version %s",
31822  ctversion, __Pyx_MODULE_NAME, rtversion);
31823  return PyErr_WarnEx(NULL, message, 1);
31824  }
31825  return 0;
31826 }
31827 
31828 /* FunctionImport */
31829  #ifndef __PYX_HAVE_RT_ImportFunction_0_29_36
31830 #define __PYX_HAVE_RT_ImportFunction_0_29_36
31831 static int __Pyx_ImportFunction_0_29_36(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
31832  PyObject *d = 0;
31833  PyObject *cobj = 0;
31834  union {
31835  void (*fp)(void);
31836  void *p;
31837  } tmp;
31838  d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
31839  if (!d)
31840  goto bad;
31841  cobj = PyDict_GetItemString(d, funcname);
31842  if (!cobj) {
31843  PyErr_Format(PyExc_ImportError,
31844  "%.200s does not export expected C function %.200s",
31845  PyModule_GetName(module), funcname);
31846  goto bad;
31847  }
31848 #if PY_VERSION_HEX >= 0x02070000
31849  if (!PyCapsule_IsValid(cobj, sig)) {
31850  PyErr_Format(PyExc_TypeError,
31851  "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
31852  PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
31853  goto bad;
31854  }
31855  tmp.p = PyCapsule_GetPointer(cobj, sig);
31856 #else
31857  {const char *desc, *s1, *s2;
31858  desc = (const char *)PyCObject_GetDesc(cobj);
31859  if (!desc)
31860  goto bad;
31861  s1 = desc; s2 = sig;
31862  while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
31863  if (*s1 != *s2) {
31864  PyErr_Format(PyExc_TypeError,
31865  "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
31866  PyModule_GetName(module), funcname, sig, desc);
31867  goto bad;
31868  }
31869  tmp.p = PyCObject_AsVoidPtr(cobj);}
31870 #endif
31871  *f = tmp.fp;
31872  if (!(*f))
31873  goto bad;
31874  Py_DECREF(d);
31875  return 0;
31876 bad:
31877  Py_XDECREF(d);
31878  return -1;
31879 }
31880 #endif
31881 
31882 /* InitStrings */
31883  static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
31884  while (t->p) {
31885  #if PY_MAJOR_VERSION < 3
31886  if (t->is_unicode) {
31887  *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
31888  } else if (t->intern) {
31889  *t->p = PyString_InternFromString(t->s);
31890  } else {
31891  *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
31892  }
31893  #else
31894  if (t->is_unicode | t->is_str) {
31895  if (t->intern) {
31896  *t->p = PyUnicode_InternFromString(t->s);
31897  } else if (t->encoding) {
31898  *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
31899  } else {
31900  *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
31901  }
31902  } else {
31903  *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
31904  }
31905  #endif
31906  if (!*t->p)
31907  return -1;
31908  if (PyObject_Hash(*t->p) == -1)
31909  return -1;
31910  ++t;
31911  }
31912  return 0;
31913 }
31914 
31915 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
31916  return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
31917 }
31918 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
31919  Py_ssize_t ignore;
31920  return __Pyx_PyObject_AsStringAndSize(o, &ignore);
31921 }
31922 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
31923 #if !CYTHON_PEP393_ENABLED
31924 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31925  char* defenc_c;
31926  PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
31927  if (!defenc) return NULL;
31928  defenc_c = PyBytes_AS_STRING(defenc);
31929 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31930  {
31931  char* end = defenc_c + PyBytes_GET_SIZE(defenc);
31932  char* c;
31933  for (c = defenc_c; c < end; c++) {
31934  if ((unsigned char) (*c) >= 128) {
31935  PyUnicode_AsASCIIString(o);
31936  return NULL;
31937  }
31938  }
31939  }
31940 #endif
31941  *length = PyBytes_GET_SIZE(defenc);
31942  return defenc_c;
31943 }
31944 #else
31945 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31946  if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
31947 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31948  if (likely(PyUnicode_IS_ASCII(o))) {
31949  *length = PyUnicode_GET_LENGTH(o);
31950  return PyUnicode_AsUTF8(o);
31951  } else {
31952  PyUnicode_AsASCIIString(o);
31953  return NULL;
31954  }
31955 #else
31956  return PyUnicode_AsUTF8AndSize(o, length);
31957 #endif
31958 }
31959 #endif
31960 #endif
31961 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
31962 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
31963  if (
31964 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
31965  __Pyx_sys_getdefaultencoding_not_ascii &&
31966 #endif
31967  PyUnicode_Check(o)) {
31968  return __Pyx_PyUnicode_AsStringAndSize(o, length);
31969  } else
31970 #endif
31971 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
31972  if (PyByteArray_Check(o)) {
31973  *length = PyByteArray_GET_SIZE(o);
31974  return PyByteArray_AS_STRING(o);
31975  } else
31976 #endif
31977  {
31978  char* result;
31979  int r = PyBytes_AsStringAndSize(o, &result, length);
31980  if (unlikely(r < 0)) {
31981  return NULL;
31982  } else {
31983  return result;
31984  }
31985  }
31986 }
31987 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
31988  int is_true = x == Py_True;
31989  if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
31990  else return PyObject_IsTrue(x);
31991 }
31992 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
31993  int retval;
31994  if (unlikely(!x)) return -1;
31995  retval = __Pyx_PyObject_IsTrue(x);
31996  Py_DECREF(x);
31997  return retval;
31998 }
31999 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
32000 #if PY_MAJOR_VERSION >= 3
32001  if (PyLong_Check(result)) {
32002  if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
32003  "__int__ returned non-int (type %.200s). "
32004  "The ability to return an instance of a strict subclass of int "
32005  "is deprecated, and may be removed in a future version of Python.",
32006  Py_TYPE(result)->tp_name)) {
32007  Py_DECREF(result);
32008  return NULL;
32009  }
32010  return result;
32011  }
32012 #endif
32013  PyErr_Format(PyExc_TypeError,
32014  "__%.4s__ returned non-%.4s (type %.200s)",
32015  type_name, type_name, Py_TYPE(result)->tp_name);
32016  Py_DECREF(result);
32017  return NULL;
32018 }
32019 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
32020 #if CYTHON_USE_TYPE_SLOTS
32021  PyNumberMethods *m;
32022 #endif
32023  const char *name = NULL;
32024  PyObject *res = NULL;
32025 #if PY_MAJOR_VERSION < 3
32026  if (likely(PyInt_Check(x) || PyLong_Check(x)))
32027 #else
32028  if (likely(PyLong_Check(x)))
32029 #endif
32030  return __Pyx_NewRef(x);
32031 #if CYTHON_USE_TYPE_SLOTS
32032  m = Py_TYPE(x)->tp_as_number;
32033  #if PY_MAJOR_VERSION < 3
32034  if (m && m->nb_int) {
32035  name = "int";
32036  res = m->nb_int(x);
32037  }
32038  else if (m && m->nb_long) {
32039  name = "long";
32040  res = m->nb_long(x);
32041  }
32042  #else
32043  if (likely(m && m->nb_int)) {
32044  name = "int";
32045  res = m->nb_int(x);
32046  }
32047  #endif
32048 #else
32049  if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
32050  res = PyNumber_Int(x);
32051  }
32052 #endif
32053  if (likely(res)) {
32054 #if PY_MAJOR_VERSION < 3
32055  if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
32056 #else
32057  if (unlikely(!PyLong_CheckExact(res))) {
32058 #endif
32059  return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
32060  }
32061  }
32062  else if (!PyErr_Occurred()) {
32063  PyErr_SetString(PyExc_TypeError,
32064  "an integer is required");
32065  }
32066  return res;
32067 }
32068 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
32069  Py_ssize_t ival;
32070  PyObject *x;
32071 #if PY_MAJOR_VERSION < 3
32072  if (likely(PyInt_CheckExact(b))) {
32073  if (sizeof(Py_ssize_t) >= sizeof(long))
32074  return PyInt_AS_LONG(b);
32075  else
32076  return PyInt_AsSsize_t(b);
32077  }
32078 #endif
32079  if (likely(PyLong_CheckExact(b))) {
32080  #if CYTHON_USE_PYLONG_INTERNALS
32081  const digit* digits = ((PyLongObject*)b)->ob_digit;
32082  const Py_ssize_t size = Py_SIZE(b);
32083  if (likely(__Pyx_sst_abs(size) <= 1)) {
32084  ival = likely(size) ? digits[0] : 0;
32085  if (size == -1) ival = -ival;
32086  return ival;
32087  } else {
32088  switch (size) {
32089  case 2:
32090  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
32091  return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32092  }
32093  break;
32094  case -2:
32095  if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
32096  return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32097  }
32098  break;
32099  case 3:
32100  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
32101  return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32102  }
32103  break;
32104  case -3:
32105  if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
32106  return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32107  }
32108  break;
32109  case 4:
32110  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
32111  return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32112  }
32113  break;
32114  case -4:
32115  if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
32116  return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
32117  }
32118  break;
32119  }
32120  }
32121  #endif
32122  return PyLong_AsSsize_t(b);
32123  }
32124  x = PyNumber_Index(b);
32125  if (!x) return -1;
32126  ival = PyInt_AsSsize_t(x);
32127  Py_DECREF(x);
32128  return ival;
32129 }
32130 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
32131  if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) {
32132  return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
32133 #if PY_MAJOR_VERSION < 3
32134  } else if (likely(PyInt_CheckExact(o))) {
32135  return PyInt_AS_LONG(o);
32136 #endif
32137  } else {
32138  Py_ssize_t ival;
32139  PyObject *x;
32140  x = PyNumber_Index(o);
32141  if (!x) return -1;
32142  ival = PyInt_AsLong(x);
32143  Py_DECREF(x);
32144  return ival;
32145  }
32146 }
32147 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
32148  return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
32149 }
32150 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
32151  return PyInt_FromSize_t(ival);
32152 }
32153 
32154 
32155 #endif /* Py_PYTHON_H */
static DataType inner_product(const DataType *vector1, const DataType *vector2, const LongIndexType vector_size)
Computes Euclidean inner product of two vectors.
int LongIndexType
Definition: types.h:60